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 65ls -l $mp1 66mount /dev/md$md2 $mp2 67chmod 777 $mp2 68 69mount -t unionfs -o below $mp1 $mp2 70set +e 71mount | grep -E "$mp1|$mp2" 72ls -ld $mp1 $mp2 73ls -l $mp1 $mp2 74 75export CTRLDIR=$mp2/stressX.control 76export INCARNATIONS=10 77export LOAD=80 78export RUNDIR=$mp2/stressX 79export runRUNTIME=5m 80export rwLOAD=80 81export symlinkLOAD=80 82 83export TESTPROGS=" 84testcases/lockf2/lockf2 85testcases/symlink/symlink 86testcases/openat/openat 87testcases/rw/rw 88testcases/fts/fts 89testcases/link/link 90testcases/lockf/lockf 91testcases/creat/creat 92testcases/mkdir/mkdir 93testcases/rename/rename 94testcases/mkfifo/mkfifo 95testcases/dirnprename/dirnprename 96testcases/dirrename/dirrename 97testcases/swap/swap 98" 99 100export TESTPROGS=`echo $TESTPROGS | sed 's/\n/ /g'` 101 102set +e 103###su $testuser -c \ 104### "(cd $mp2/stress2; ./testcases/run/run $TESTPROGS)" 105 106umount $mp2 # The unionfs mount 107umount $mp2 108n=`find $mp1/stressX | wc -l` 109[ $n -eq 1 ] && s=0 || { find $mp1/stressX -ls | head -12; s=1; } 110umount $mp1 111mdconfig -d -u $md2 112mdconfig -d -u $md1 113rm -f $I 114exit $s 115