1#!/bin/sh 2 3# 4# Copyright (c) 2015 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# Variation of crossmp3.sh. fifos and sockets added to load. 30# Not really a cross mount point test, but a test of the old 31# non-directory use of the vnode v_un union. 32# mckusick@ suggested using fifos for this test. 33 34# "panic: mtx_lock() of spin mutex @ ../kern/vfs_subr.c:512" seen. 35# https://people.freebsd.org/~pho/stress/log/crossmp8.txt 36# Fixed by r291671. 37 38[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 39 40. ../default.cfg 41 42CONT=/tmp/crossmp8.continue 43N=`sysctl -n hw.ncpu` 44[ $N -gt 32 ] && N=32 # Arbitrary cap 45usermem=`sysctl -n hw.usermem` 46[ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80)) 47size=$((usermem / 1024 / 1024 / N)) 48 49mounts=$N # Number of parallel scripts 50 51if [ $# -eq 0 ]; then 52 oldmx=`sysctl -n kern.maxvnodes` 53 trap "sysctl kern.maxvnodes=$oldmx > /dev/null" EXIT SIGINT 54 sysctl kern.maxvnodes=3072 > /dev/null 55 56 for i in `jot $mounts`; do 57 m=$((i + mdstart - 1)) 58 [ ! -d ${mntpoint}$m ] && 59 { mkdir ${mntpoint}$m; chmod 755 ${mntpoint}$m; } 60 mount | grep "${mntpoint}$m " | grep -q md$m && 61 umount ${mntpoint}$m 62 mdconfig -l | grep -q md$m && mdconfig -d -u $m 63 64 mdconfig -a -t swap -s ${size}m -u $m 65 newfs md${m} > /dev/null 2>&1 66 done 67 68 # start the parallel tests 69 touch $CONT 70 for i in `jot $mounts`; do 71 m=$((i + mdstart - 1)) 72 ./$0 $m & 73 ./$0 find & 74 done 75 sleep 60 76 rm -f $CONT 77 ../tools/killall.sh 78 wait 79 80 for i in `jot $mounts`; do 81 m=$((i + mdstart - 1)) 82 while mount | grep -q "on ${mntpoint}$m "; do 83 umount ${mntpoint}$m && break 84 sleep 1 85 done 86 mdconfig -d -u $m 87 done 88 ./cleanup.sh 89 exit 0 90else 91 if [ $1 = find ]; then 92 while [ -f $CONT ]; do 93 find ${mntpoint}* -maxdepth 1 -ls > /dev/null 2>&1 94 sleep .1 95 done 96 else 97 export RUNTIME=15s 98 export runRUNTIME=15s 99 # The test: Parallel mount and unmounts 100 start=`date '+%s'` 101 while [ $((`date '+%s'` - start)) -lt 300 ]; do 102 m=$1 103 mount /dev/md${m} ${mntpoint}$m && 104 chmod 777 ${mntpoint}$m 105 export RUNDIR=${mntpoint}$m/stressX 106 export CTRLDIR=${mntpoint}$m/stressX.control 107 export mkfifoLOAD=80 108 export socketLOAD=80 109 export TP=" 110 testcases/mkfifo/mkfifo 111 testcases/mkdir/mkdir 112 " 113 (cd ${mntpoint}$m && find . -delete) 114 su $testuser -c 'cd ..; ./testcases/run/run $TP' > \ 115 /dev/null 2>&1 116 117 while mount | grep -q "on ${mntpoint}$m "; do 118 opt=$([ $((`date '+%s'` % 2)) -eq 0 ] && echo "-f") 119 umount $opt ${mntpoint}$m > /dev/null 2>&1 120 [ -f $CONT ] || break 2 121 done 122 done 123 rm -f $CONT 124 fi 125fi 126