1#!/bin/sh 2 3# 4# SPDX-License-Identifier: BSD-2-Clause-FreeBSD 5# 6# Copyright (c) 2021 Peter Holm 7# 8# Redistribution and use in source and binary forms, with or without 9# modification, are permitted provided that the following conditions 10# are met: 11# 1. Redistributions of source code must retain the above copyright 12# notice, this list of conditions and the following disclaimer. 13# 2. Redistributions in binary form must reproduce the above copyright 14# notice, this list of conditions and the following disclaimer in the 15# documentation and/or other materials provided with the distribution. 16# 17# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27# SUCH DAMAGE. 28# 29 30# unionfs(8) test with a cd9660 file system 31 32# "panic: unionfs_noderem: vnode 0xfffffe014f9259c8 locked recursively" seen 33# https://people.freebsd.org/~pho/stress/log/log0233.txt 34 35[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 36[ -z "`type mkisofs 2>/dev/null`" ] && 37 { echo "cdrtools not installed"; exit 0; } 38. ../default.cfg 39 40I=`dirname $diskimage`/unionfs8.iso 41md1=$mdstart 42md2=$((md1 + 1)) 43mp1=/mnt$md1 44mp2=/mnt$md2 45mkdir -p $mp1 $mp2 46set -e 47for i in $mp1 $mp2; do 48 mount | grep -q "on $i " && umount -f $i 49done 50for i in $md1 $md2; do 51 mdconfig -l | grep -q md$i && mdconfig -d -u $i 52done 53 54mdconfig -a -t swap -s 4g -u $md1 55mdconfig -a -t swap -s 4g -u $md2 56newfs $newfs_flags -n md$md1 > /dev/null 57newfs $newfs_flags -n md$md2 > /dev/null 58mount /dev/md$md1 $mp1 59cp -r ../../stress2 $mp1 60mkisofs -o $I -r $mp1 > /dev/null 2>&1 61umount $mp1 62mdconfig -d -u $md1 63mdconfig -a -t vnode -f $I -u $md1 64mount -t cd9660 /dev/md$mdstart $mp1 65mount /dev/md$md2 $mp2 66chmod 777 $mp2 67 68mount -t unionfs -o below $mp1 $mp2 69set +e 70mount | grep -E "$mp1|$mp2" 71 72export CTRLDIR=$mp2/stressX.control 73export INCARNATIONS=10 74export LOAD=80 75export RUNDIR=$mp2/stressX 76export runRUNTIME=5m 77export rwLOAD=80 78export symlinkLOAD=80 79 80export TESTPROGS=" 81testcases/lockf2/lockf2 82testcases/symlink/symlink 83testcases/openat/openat 84testcases/rw/rw 85testcases/fts/fts 86testcases/link/link 87testcases/lockf/lockf 88testcases/creat/creat 89testcases/mkdir/mkdir 90testcases/rename/rename 91testcases/mkfifo/mkfifo 92testcases/dirnprename/dirnprename 93testcases/dirrename/dirrename 94testcases/swap/swap 95" 96 97export TESTPROGS=`echo $TESTPROGS | sed 's/\n/ /g'` 98 99set +e 100su $testuser -c \ 101 "(cd $mp2/stress2; ./testcases/run/run $TESTPROGS)" 102 103n=`find $mp2/stressX 2>/dev/null | wc -l` 104[ $n -eq 1 ] && s=0 || { find $mp2/stressX -ls 2>/dev/null | head -12; s=1; } 105 106while mount | grep "on $mp2" | grep -q unionfs; do 107 umount $mp2 && break 108done 109for i in `jot 5`; do 110 umount $mp2 && break 111 sleep .5 112done 113for i in `jot 5`; do 114 umount $mp1 && break 115 sleep .5 116done 117mdconfig -d -u $md2 118mdconfig -d -u $md1 119rm -f $I 120exit $s 121