4 # Copyright (c) 2014 EMC Corp.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
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.
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
29 # Parallel mount and umount of file systems
30 # "panic: Bad link elm 0xfffff8052a20cc00 prev->next != elm" seen:
31 # http://people.freebsd.org/~pho/stress/log/crossmp3.txt
34 # panic: softdep_waitidle: work added after flush:
35 # http://people.freebsd.org/~pho/stress/log/crossmp3-2.txt, fixed by r273967.
37 [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
41 CONT=/tmp/crossmp3.continue
44 usermem=`sysctl -n hw.usermem`
45 [ `sysctl -n vm.swap_total` -eq 0 ] && usermem=$((usermem / 2))
46 size=$((usermem / 1024 / 1024 / N))
47 echo "Using $N memory disks of size $size MB."
49 mounts=$N # Number of parallel scripts
51 for i in `jot $mounts`; do
52 m=$(( i + mdstart - 1 ))
53 [ ! -d ${mntpoint}$m ] &&
54 { mkdir ${mntpoint}$m; chmod 755 ${mntpoint}$m; }
55 mount | grep "${mntpoint}$m " | grep -q md$m &&
57 mdconfig -l | grep -q md$m && mdconfig -d -u $m
59 mdconfig -a -t swap -s ${size}m -u $m
61 newfs $newfs_flags md${m}$part > /dev/null 2>&1
64 # start the parallel tests
66 for i in `jot $mounts`; do
67 m=$(( i + mdstart - 1 ))
73 for i in `jot $mounts`; do
74 m=$(( i + mdstart - 1 ))
75 while mount | grep -q "on ${mntpoint}$m "; do
76 umount ${mntpoint}$m && break
83 if [ $1 = find ]; then
84 while [ -f $CONT ]; do
85 find ${mntpoint}* -type f > /dev/null 2>&1
89 # The test: Parallel mount and unmounts
92 mount /dev/md${m}$part ${mntpoint}$m &&
93 chmod 777 ${mntpoint}$m
94 export RUNDIR=${mntpoint}$m/stressX
95 export CTRLDIR=${mntpoint}$m/stressX.control
96 (cd ${mntpoint}$m && find . -delete)
97 su $testuser -c 'cd ..; ./run.sh disk.cfg' > \
100 while mount | grep -q "on ${mntpoint}$m "; do
101 opt=$([ $((`date '+%s'` % 2)) -eq 0 ] && echo "-f")
102 umount $opt ${mntpoint}$m > /dev/null 2>&1
103 [ -f $CONT ] || break 2