Index: user/pho/stress2/misc/crossmp3.sh =================================================================== --- user/pho/stress2/misc/crossmp3.sh (revision 282918) +++ user/pho/stress2/misc/crossmp3.sh (revision 282919) @@ -1,103 +1,105 @@ #!/bin/sh # # Copyright (c) 2014 EMC Corp. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # # Parallel mount and umount of file systems # "panic: Bad link elm 0xfffff8052a20cc00 prev->next != elm" seen: # http://people.freebsd.org/~pho/stress/log/crossmp3.txt # Fixed in r269853 # panic: softdep_waitidle: work added after flush: # http://people.freebsd.org/~pho/stress/log/crossmp3-2.txt, fixed by r273967. [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg N=`sysctl -n hw.ncpu` -size=$((`sysctl -n hw.usermem` / 1024 / 1024 / N)) +usermem=`sysctl -n hw.usermem` +[ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80)) +size=$((usermem / 1024 / 1024 / N)) mounts=$N # Number of parallel scripts if [ $# -eq 0 ]; then for i in `jot $mounts`; do m=$(( i + mdstart - 1 )) [ ! -d ${mntpoint}$m ] && mkdir ${mntpoint}$m mount | grep "${mntpoint}$m" | grep -q md$m && umount ${mntpoint}$m mdconfig -l | grep -q md$m && mdconfig -d -u $m mdconfig -a -t swap -s ${size}m -u $m bsdlabel -w md$m auto newfs $newfs_flags md${m}$part > /dev/null 2>&1 done # start the parallel tests for i in `jot $mounts`; do m=$(( i + mdstart - 1 )) ./$0 $m & ./$0 find & done for i in `jot $mounts`; do wait; wait done for i in `jot $mounts`; do m=$(( i + mdstart - 1 )) mdconfig -d -u $m rm -f $D$m done else touch /tmp/crossmp.continue if [ $1 = find ]; then while [ -f /tmp/crossmp.continue ]; do find ${mntpoint}* -type f > /dev/null 2>&1 done else export runRUNTIME=20s # The test: Parallel mount and unmounts for i in `jot 3`; do m=$1 mount /dev/md${m}${part} ${mntpoint}$m chmod 777 ${mntpoint}$m export RUNDIR=${mntpoint}$m/stressX export CTRLDIR=${mntpoint}$m/stressX.control (cd ${mntpoint}$m && find . -delete) su $testuser -c 'cd ..; ./run.sh disk.cfg' > \ /dev/null 2>&1 while mount | grep -q "on ${mntpoint}$m "; do opt=$([ $((`date '+%s'` % 2)) -eq 0 ] && echo "-f") umount $opt ${mntpoint}$m > /dev/null 2>&1 done done rm -f /tmp/crossmp.continue fi fi Index: user/pho/stress2/misc/crossmp4.sh =================================================================== --- user/pho/stress2/misc/crossmp4.sh (revision 282918) +++ user/pho/stress2/misc/crossmp4.sh (revision 282919) @@ -1,108 +1,110 @@ #!/bin/sh # # Copyright (c) 2014 EMC Corp. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # # Parallel mount and umount of file systems. Nullfs version. # "panic: Lock (lockmgr) null not locked @ kern/vfs_default.c:523." seen. # http://people.freebsd.org/~pho/stress/log/kostik698.txt # Fixed by r269708. [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg N=`sysctl -n hw.ncpu` -size=$((`sysctl -n hw.usermem` / 1024 / 1024)) +usermem=`sysctl -n hw.usermem` +[ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80)) +size=$((usermem / 1024 / 1024 / N)) mounts=$N # Number of parallel scripts if [ $# -eq 0 ]; then mount | grep "$mntpoint" | grep -q md && umount ${mntpoint} mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart mdconfig -a -t swap -s ${size}m -u $mdstart bsdlabel -w md$mdstart auto newfs $newfs_flags md${mdstart}$part > /dev/null 2>&1 mount /dev/md${mdstart}$part $mntpoint # start the parallel tests for i in `jot $mounts`; do m=$(( i + mdstart - 1 )) ./$0 $m & ./$0 find & done for i in `jot $mounts`; do wait; wait done for i in `jot $mounts`; do rm -f $D$m done while mount | grep -q "on $mntpoint "; do umount $mntpoint > /dev/null 2>&1 || sleep 1 done mdconfig -d -u $mdstart else touch /tmp/crossmp.continue if [ $1 = find ]; then while [ -f /tmp/crossmp.continue ]; do find ${mntpoint}* -type f > /dev/null 2>&1 done else m=$1 set `df -ik $mntpoint | tail -1 | awk '{print $4,$7}'` export KBLOCKS=$(($1 / N)) export INODES=$(($2 / N)) export runRUNTIME=1m export INCARNATIONS=4 # The test: Parallel mount and unmounts for i in `jot 4`; do [ ! -d ${mntpoint}$m ] && mkdir ${mntpoint}$m mount -t nullfs $mntpoint ${mntpoint}$m mkdir -p ${mntpoint}$m/$m chmod 777 ${mntpoint}$m/$m export RUNDIR=${mntpoint}$m/$m/stressX export CTRLDIR=${mntpoint}$m/$m/stressX.control (cd ${mntpoint}$m/$m && find . -delete) su $testuser -c 'cd ..; ./run.sh disk.cfg' > \ /dev/null 2>&1 & sleep 30 while mount | grep -q "on ${mntpoint}$m "; do opt=$([ $((`date '+%s'` % 2)) -eq 0 ] && echo "-f") umount $opt ${mntpoint}$m > /dev/null 2>&1 done wait done rm -f /tmp/crossmp.continue fi fi Index: user/pho/stress2/misc/crossmp5.sh =================================================================== --- user/pho/stress2/misc/crossmp5.sh (revision 282918) +++ user/pho/stress2/misc/crossmp5.sh (revision 282919) @@ -1,98 +1,100 @@ #!/bin/sh # # Copyright (c) 2014 EMC Corp. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # # Variation of crossmp3.sh [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg N=`sysctl -n hw.ncpu` -size=$((`sysctl -n hw.usermem` / 1024 / 1024 / N)) +usermem=`sysctl -n hw.usermem` +[ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80)) +size=$((usermem / 1024 / 1024 / N)) mounts=$N # Number of parallel scripts if [ $# -eq 0 ]; then for i in `jot $mounts`; do m=$(( i + mdstart - 1 )) [ ! -d ${mntpoint}$m ] && mkdir ${mntpoint}$m mount | grep "${mntpoint}$m" | grep -q md$m && umount ${mntpoint}$m mdconfig -l | grep -q md$m && mdconfig -d -u $m mdconfig -a -t swap -s ${size}m -u $m bsdlabel -w md$m auto newfs $newfs_flags md${m}$part > /dev/null 2>&1 done # start the parallel tests for i in `jot $mounts`; do m=$(( i + mdstart - 1 )) ./$0 $m & ./$0 find & done for i in `jot $mounts`; do wait; wait done for i in `jot $mounts`; do m=$(( i + mdstart - 1 )) mdconfig -d -u $m rm -f $D$m done else touch /tmp/crossmp.continue if [ $1 = find ]; then while [ -f /tmp/crossmp.continue ]; do find ${mntpoint}* -type f > /dev/null 2>&1 done else # The test: Parallel mount and unmount m=$1 for i in `jot 200`; do mount /dev/md${m}${part} ${mntpoint}$m chmod 777 ${mntpoint}$m l=`od -An -N2 -t u2 /dev/random | sed 's/ //g'` dd if=/dev/zero of=$mntpoint/$i bs=$l count=100 \ 2>&1 | egrep -v 'records|transferred' rm -f $mntpoint/$i while mount | grep -q "on ${mntpoint}$m "; do opt=$([ $((`date '+%s'` % 2)) -eq 0 ] && echo "-f") umount $opt ${mntpoint}$m > /dev/null 2>&1 done done rm -f /tmp/crossmp.continue fi fi Index: user/pho/stress2/misc/mlockall2.sh =================================================================== --- user/pho/stress2/misc/mlockall2.sh (revision 282918) +++ user/pho/stress2/misc/mlockall2.sh (revision 282919) @@ -1,150 +1,151 @@ #!/bin/sh # # Copyright (c) 2012 Peter Holm # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg # core dumps seen in watchdogd after mlockall() was added. # This scenario demonstrates the problem. Fixed in r242012. -mem=`sysctl hw.usermem | awk '{print $NF}'` +mem=`sysctl -n hw.usermem` +[ `swapinfo | wc -l` -eq 1 ] && mem=$((mem/100*60)) here=`pwd` cd /tmp sed '1,/^EOF/d' < $here/$0 > mlockall2.c mycc -o mlockall2 -Wall -Wextra -O2 -g mlockall2.c rm -f mlockall2.c cd $here rm -f mlockall2.core /tmp/mlockall2 $mem & while kill -0 $! 2>/dev/null; do [ -r mlockall2.core ] && kill $! && break sleep 10 done [ -r mlockall2.core ] && echo "FAIL" killall mlockall2 rm -f /tmp/mlockall2 exit 0 EOF #include #include #include #include #include #include #include #define LOAD 40 #define N 90000 #define PARALLEL 5 long size; void swap(void) { char *c; int page; long i; setproctitle("swap"); c = malloc(size); while (c == NULL) { size -= 1024 * 1024; c = malloc(size); } page = getpagesize(); for (;;) { i = 0; while (i < size) { c[i] = 0; i += page; } } } void test(void) { pid_t p; int i, status; setproctitle("test"); for (i = 0; i < N; i++) { if ((p = fork()) == 0) { _exit(0); } if (p > 0) wait(&status); if (status != 0) break; } _exit(0); } int main(int argc __unused, char **argv) { struct rtprio rtp; int i, j; size = atol(argv[1]) / LOAD * 1.5; for (i = 0; i < LOAD; i++) if (fork() == 0) swap(); sleep(10); rtp.type = RTP_PRIO_REALTIME; rtp.prio = 0; if (rtprio(RTP_SET, 0, &rtp) == -1) err(1, "rtprio"); if (madvise(0, 0, MADV_PROTECT) != 0) err(1, "madvise failed"); if (mlockall(MCL_CURRENT | MCL_FUTURE) != 0) err(1, "mlockall failed"); alarm(600); for (j = 0; j < 10; j++) { for (i = 0; i < PARALLEL; i++) { if (fork() == 0) test(); } for (i = 0; i < PARALLEL; i++) wait(NULL); if (access("mlockall2.core", R_OK) == 0) break; } return (0); } Index: user/pho/stress2/misc/pfl.sh =================================================================== --- user/pho/stress2/misc/pfl.sh (revision 282918) +++ user/pho/stress2/misc/pfl.sh (revision 282919) @@ -1,167 +1,174 @@ #!/bin/sh # # Copyright (c) 2013 EMC Corp. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 # Test scenario for the change of a global SU lock to a per filesystem lock. . ../default.cfg here=`pwd` cd /tmp sed '1,/^EOF/d' < $here/$0 > pfl.c mycc -o pfl -Wall -Wextra pfl.c || exit 1 rm -f pfl.c cd $here mp1=$mntpoint mp2=${mntpoint}2 [ -d $mp2 ] || mkdir -p $mp2 md1=$mdstart md2=$((mdstart + 1)) +usermem=`sysctl -n hw.usermem` +[ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80)) +size=$((2 * 1024 * 1024 * 1024)) # Ideal disk size is 2G +[ $((size * 2)) -gt $usermem ] && size=$((usermem / 2)) +size=$((size / 1024 / 1024)) + opt=$([ $((`date '+%s'` % 2)) -eq 0 ] && echo "-j" || echo "-U") +[ "$newfs_flags" = "-U" ] || opt="" mount | grep "on $mp1 " | grep -q /dev/md && umount -f $mp1 mdconfig -l | grep -q md$md1 && mdconfig -d -u $md1 -mdconfig -a -t swap -s 2g -u $md1 +mdconfig -a -t swap -s ${size}m -u $md1 bsdlabel -w md$md1 auto newfs $opt md${md1}$part > /dev/null mount /dev/md${md1}$part $mp1 chmod 777 $mp1 mount | grep "on $mp2 " | grep -q /dev/md && umount -f $mp2 mdconfig -l | grep -q md$md2 && mdconfig -d -u $md2 -mdconfig -a -t swap -s 2g -u $md2 +mdconfig -a -t swap -s ${size}m -u $md2 bsdlabel -w md$md2 auto newfs $opt md${md2}$part > /dev/null mount /dev/md${md2}$part $mp2 chmod 777 $mp2 su ${testuser} -c "cd $mp1; /tmp/pfl" & su ${testuser} -c "cd $mp2; /tmp/pfl" & wait; wait while mount | grep "$mp2 " | grep -q /dev/md; do umount $mp2 || sleep 1 done mdconfig -d -u $md2 while mount | grep "$mp1 " | grep -q /dev/md; do umount $mp1 || sleep 1 done mdconfig -d -u $md1 exit EOF #include #include #include #include #include #include #include #include #include #include #include #define PARALLEL 10 static int size = 10000; void test(void) { int fd, i, j; pid_t pid; char file[128]; pid = getpid(); sprintf(file,"d%05d", pid); if (mkdir(file, 0740) == -1) err(1, "mkdir(%s)", file); chdir(file); for (j = 0; j < size; j++) { sprintf(file,"p%05d.%05d", pid, j); if ((fd = open(file, O_CREAT | O_TRUNC | O_WRONLY, 0644)) == -1) { if (errno != EINTR) { warn("mkdir(%s). %s:%d", file, __FILE__, __LINE__); unlink("continue"); break; } } if (arc4random() % 100 < 10) if (write(fd, "1", 1) != 1) err(1, "write()"); close(fd); } sleep(3); for (i = --j; i >= 0; i--) { sprintf(file,"p%05d.%05d", pid, i); if (unlink(file) == -1) err(3, "unlink(%s)", file); } chdir(".."); sprintf(file,"d%05d", pid); if (rmdir(file) == -1) err(3, "unlink(%s)", file); } int main(void) { int fd, i, j, k; umask(0); if ((fd = open("continue", O_CREAT, 0644)) == -1) err(1, "open()"); close(fd); for (i = 0; i < 1; i++) { for (j = 0; j < PARALLEL; j++) { if (fork() == 0) { for (k = 0; k < 50; k++) test(); exit(0); } } for (j = 0; j < PARALLEL; j++) wait(NULL); if (access("continue", R_OK) == -1) { fprintf(stderr, "Loop #%d\n", i + 1); fflush(stderr); break; } } unlink("continue"); return (0); } Index: user/pho/stress2/misc/pfl2.sh =================================================================== --- user/pho/stress2/misc/pfl2.sh (revision 282918) +++ user/pho/stress2/misc/pfl2.sh (revision 282919) @@ -1,96 +1,104 @@ #!/bin/sh # # Copyright (c) 2013 EMC Corp. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 # Test scenario for the change of a global SU lock to a per filesystem lock. # "panic: softdep_write_inodeblock: indirect pointer #0 mismatch ..." seen. # http://people.freebsd.org/~pho/stress/log/kirk063.txt . ../default.cfg +[ `swapinfo | wc -l` -eq 1 ] && exit 0 + mp1=$mntpoint mp2=${mntpoint}2 [ -d $mp2 ] || mkdir -p $mp2 md1=$mdstart md2=$((mdstart + 1)) +usermem=`sysctl -n hw.usermem` +size=$((2 * 1024 * 1024 * 1024)) # Ideal disk size is 2G +[ $((size * 2)) -gt $usermem ] && size=$((usermem / 2)) +size=$((size / 1024 / 1024)) + opt=$([ $((`date '+%s'` % 2)) -eq 0 ] && echo "-j" || echo "-U") +[ "$newfs_flags" = "-U" ] || opt="" mount | grep "on $mp1 " | grep -q /dev/md && umount -f $mp1 mdconfig -l | grep -q md$md1 && mdconfig -d -u $md1 -mdconfig -a -t swap -s 2g -u $md1 +mdconfig -a -t swap -s ${size}m -u $md1 bsdlabel -w md$md1 auto newfs $opt md${md1}$part > /dev/null mount /dev/md${md1}$part $mp1 chmod 777 $mp1 mount | grep "on $mp2 " | grep -q /dev/md && umount -f $mp2 mdconfig -l | grep -q md$md2 && mdconfig -d -u $md2 -mdconfig -a -t swap -s 2g -u $md2 +mdconfig -a -t swap -s ${size}m -u $md2 bsdlabel -w md$md2 auto newfs $opt md${md2}$part > /dev/null mount /dev/md${md2}$part $mp2 chmod 777 $mp2 export runRUNTIME=10m export RUNDIR=$mp1/stressX export CTRLDIR=$mp1/stressX.control export LOAD=80 export symlinkLOAD=80 export rwLOAD=80 export TESTPROGS=" testcases/lockf2/lockf2 testcases/symlink/symlink testcases/openat/openat testcases/rw/rw testcases/fts/fts testcases/link/link testcases/lockf/lockf testcases/creat/creat testcases/mkdir/mkdir testcases/rename/rename testcases/mkfifo/mkfifo " su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > /dev/null 2>&1 & export TESTPROGS="$TESTPROGS testcases/swap/swap" export RUNDIR=$mp2/stressX export CTRLDIR=$mp2/stressX.control su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > /dev/null 2>&1 & wait; wait while mount | grep "$mp2 " | grep -q /dev/md; do umount $mp2 || sleep 1 done mdconfig -d -u $md2 while mount | grep "$mp1 " | grep -q /dev/md; do umount $mp1 || sleep 1 done mdconfig -d -u $md1 Index: user/pho/stress2/misc/tmpfs.sh =================================================================== --- user/pho/stress2/misc/tmpfs.sh (revision 282918) +++ user/pho/stress2/misc/tmpfs.sh (revision 282919) @@ -1,47 +1,50 @@ #!/bin/sh # # Copyright (c) 2009-2011 Peter Holm # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # # panic: tmpfs_alloc_vp: type 0xc866ce58 0, seen. [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg mount | grep "$mntpoint" | grep -q tmpfs && umount $mntpoint -mount -t tmpfs tmpfs $mntpoint +usermem=`sysctl -n hw.usermem` +[ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80)) +size=$((usermem / 1024 / 1024 / 2)) +mount -o size=${size}m -t tmpfs tmpfs $mntpoint export RUNDIR=$mntpoint/stressX export runRUNTIME=10m # Run tests for 10 minutes (cd ..; ./run.sh marcus.cfg) while mount | grep $mntpoint | grep -q tmpfs; do umount $mntpoint || sleep 1 done Index: user/pho/stress2/misc/tmpfs13.sh =================================================================== --- user/pho/stress2/misc/tmpfs13.sh (revision 282918) +++ user/pho/stress2/misc/tmpfs13.sh (revision 282919) @@ -1,88 +1,90 @@ #!/bin/sh # # Copyright (c) 2014 EMC Corp. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 # umount -f test scenario # "panic: deadlkres: possible deadlock detected..." seen. # http://people.freebsd.org/~pho/stress/log/tmpfs13.txt # Fixed by r269457. . ../default.cfg N=`sysctl -n hw.ncpu` -size=$((`sysctl -n hw.usermem` / 1024 / 1024 / N)) +usermem=`sysctl -n hw.usermem` +[ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80)) +size=$((usermem / 1024 / 1024 / 2)) export runRUNTIME=15m export RUNDIR=$mp1/stressX export CTRLDIR=$mp1/stressX.control export LOAD=80 export symlinkLOAD=80 export rwLOAD=80 export TESTPROGS=" testcases/lockf2/lockf2 testcases/symlink/symlink testcases/openat/openat testcases/rw/rw testcases/fts/fts testcases/link/link testcases/lockf/lockf testcases/creat/creat testcases/mkdir/mkdir testcases/rename/rename testcases/mkfifo/mkfifo " for i in `jot $N 1`; do eval mp$i=${mntpoint}$i done for i in `jot $N 1`; do eval mp=\$mp$i [ -d $mp ] || mkdir -p $mp mount | grep $mp | grep -q tmpfs && umount -f $mp mount -o size=${size}m -t tmpfs tmpfs $mp chmod 777 $mp export RUNDIR=$mp/stressX export CTRLDIR=$mp/stressX.control su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > \ /dev/null 2>&1 & done sleep 60 for i in `jot $N 1`; do eval mp=\$mp$i while mount | grep "$mp " | grep -q tmpfs; do umount -f $mp || sleep 1 done done ../tools/killall.sh