1#!/bin/sh 2 3# 4# Copyright (c) 2013 EMC Corp. 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions 9# are met: 10# 1. Redistributions of source code must retain the above copyright 11# notice, this list of conditions and the following disclaimer. 12# 2. Redistributions in binary form must reproduce the above copyright 13# notice, this list of conditions and the following disclaimer in the 14# documentation and/or other materials provided with the distribution. 15# 16# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26# SUCH DAMAGE. 27# 28 29[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 30 31# Test scenario for the change of a global SU lock to a per filesystem lock. 32# "panic: softdep_write_inodeblock: indirect pointer #0 mismatch ..." seen. 33# http://people.freebsd.org/~pho/stress/log/kirk063.txt 34 35# https://people.freebsd.org/~pho/stress/log/kirk080.txt 36 37. ../default.cfg 38 39[ `swapinfo | wc -l` -eq 1 ] && exit 0 40 41md1=$mdstart 42md2=$((mdstart + 1)) 43mp1=${mntpoint}$md1 44mp2=${mntpoint}$md2 45mkdir -p $mp1 $mp2 46 47usermem=`sysctl -n hw.usermem` 48size=$((2 * 1024 * 1024 * 1024)) # Ideal disk size is 2G 49[ $((size * 2)) -gt $usermem ] && size=$((usermem / 2)) 50size=$((size / 1024 / 1024)) 51 52opt=$([ $((`date '+%s'` % 2)) -eq 0 ] && echo "-j" || echo "-U") 53[ "$newfs_flags" = "-U" ] || opt="" 54mount | grep "on $mp1 " | grep -q /dev/md && umount -f $mp1 55mdconfig -l | grep -q md$md1 && mdconfig -d -u $md1 56mdconfig -a -t swap -s ${size}m -u $md1 57bsdlabel -w md$md1 auto 58newfs $opt md${md1}$part > /dev/null 59mount /dev/md${md1}$part $mp1 60chmod 777 $mp1 61 62mount | grep "on $mp2 " | grep -q /dev/md && umount -f $mp2 63mdconfig -l | grep -q md$md2 && mdconfig -d -u $md2 64mdconfig -a -t swap -s ${size}m -u $md2 65bsdlabel -w md$md2 auto 66newfs $opt md${md2}$part > /dev/null 67mount /dev/md${md2}$part $mp2 68chmod 777 $mp2 69 70export runRUNTIME=10m 71export RUNDIR=$mp1/stressX 72export CTRLDIR=$mp1/stressX.control 73export LOAD=80 74export symlinkLOAD=80 75export rwLOAD=80 76export TESTPROGS=" 77testcases/lockf2/lockf2 78testcases/symlink/symlink 79testcases/openat/openat 80testcases/rw/rw 81testcases/fts/fts 82testcases/link/link 83testcases/lockf/lockf 84testcases/creat/creat 85testcases/mkdir/mkdir 86testcases/rename/rename 87testcases/mkfifo/mkfifo 88" 89su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > /dev/null 2>&1 & 90 91export TESTPROGS="$TESTPROGS testcases/swap/swap" 92export RUNDIR=$mp2/stressX 93export CTRLDIR=$mp2/stressX.control 94su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > /dev/null 2>&1 & 95wait 96 97while mount | grep "$mp2 " | grep -q /dev/md; do 98 umount $mp2 || sleep 1 99done 100mdconfig -d -u $md2 101while mount | grep "$mp1 " | grep -q /dev/md; do 102 umount $mp1 || sleep 1 103done 104mdconfig -d -u $md1 105