Index: user/pho/stress2/misc/core2.sh =================================================================== --- user/pho/stress2/misc/core2.sh (revision 296724) +++ user/pho/stress2/misc/core2.sh (revision 296725) @@ -1,95 +1,96 @@ #!/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$ # # Test multiple (parallel) core dumps and umount . ../default.cfg odir=`pwd` cd /tmp sed '1,/^EOF/d' < $odir/$0 > core2.c mycc -o core2 -Wall -Wextra -O0 core2.c || exit 1 rm -f core2.c cd $RUNDIR mount | grep "on $mntpoint " | grep -q md$mdstart && umount $mntpoint [ -c /dev/mn$mdstart ] && mdconfig -d -u $mdstart mdconfig -a -t swap -s 1g -u $mdstart bsdlabel -w md$mdstart auto newfs $newfs_flags md${mdstart}$part > /dev/null mount /dev/md${mdstart}$part $mntpoint touch /tmp/continue for i in `jot 64`; do mkdir -p $mntpoint/d$i (cd $mntpoint; /tmp/core2) & done rm -f /tmp/continue for i in `jot 60`; do umount $mntpoint 2>/dev/null || sleep 1 mount | grep -q "on $mntpoint " || break done +wait mount | grep -q "on $mntpoint " && umount -f $mntpoint mdconfig -d -u $mdstart rm -f core2 exit EOF #include #include #include #include #include #include #include #include #define SIZ 1L * 128 * 1024 * 1024 void *p; int main(void) { size_t len; len = SIZ; p = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0); while (access("/tmp/continue", R_OK) == 0) usleep(1); raise(SIGSEGV); return (0); } Index: user/pho/stress2/misc/dangling.sh =================================================================== --- user/pho/stress2/misc/dangling.sh (revision 296724) +++ user/pho/stress2/misc/dangling.sh (revision 296725) @@ -1,85 +1,86 @@ #!/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 # "panic: softdep_deallocate_dependencies: dangling deps" seen. # "panic: softdep_write_inodeblock: indirect pointer #0 mismatch" seen. # http://people.freebsd.org/~pho/stress/log/dangling.txt # http://people.freebsd.org/~pho/stress/log/dangling2.txt # Test scenario seems optimized for 4 CPUs. . ../default.cfg mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart mdconfig -a -t swap -s 4g -u $mdstart || exit 1 bsdlabel -w md$mdstart auto newfs $newfs_flags md${mdstart}$part > /dev/null mount /dev/md${mdstart}$part $mntpoint chmod 777 $mntpoint export runRUNTIME=4m export RUNDIR=$mntpoint/stressX set `df -ik /mnt | tail -1 | awk '{print $4,$7}'` export KBLOCKS=$(($1 / 4)) export INODES=$(($2 / 4)) export symlinkHOG=1 export rwHOG=1 export mkdirHOG=1 export LOAD=100 export symlinkLOAD=100 export rwLOAD=100 export mkdirLOAD=100 export TESTPROGS=" testcases/symlink/symlink testcases/fts/fts testcases/mkdir/mkdir testcases/rw/rw " for i in `jot 10`; do su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > \ /dev/null 2>&1 & sleep 60 kill $! ../tools/killall.sh > /dev/null 2>&1 ../tools/killall.sh > /dev/null 2>&1 + wait done while mount | grep $mntpoint | grep -q /dev/md; do umount $mntpoint || sleep 1 done mdconfig -d -u $mdstart Index: user/pho/stress2/misc/fts.sh =================================================================== --- user/pho/stress2/misc/fts.sh (revision 296724) +++ user/pho/stress2/misc/fts.sh (revision 296725) @@ -1,143 +1,144 @@ #!/bin/sh # # Copyright (c) 2013 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 # Run with marcus.cfg on a 1g swap backed MD # "panic: vm_radix_remove: invalid key found" seen. . ../default.cfg here=`pwd` cd /tmp sed '1,/^EOF/d' < $here/$0 > fts.c mycc -o fts -Wall -Wextra fts.c rm -f fts.c cd $here mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart mdconfig -a -t swap -s 1g -u $mdstart || exit 1 bsdlabel -w md$mdstart auto newfs $newfs_flags md${mdstart}$part > /dev/null mount /dev/md${mdstart}$part $mntpoint chmod 777 $mntpoint export runRUNTIME=30m export RUNDIR=$mntpoint/stressX su $testuser -c 'cd ..; ./run.sh marcus.cfg' > /dev/null & pid=$! while kill -0 $pid 2> /dev/null; do /tmp/fts $mntpoint sleep 1 done +wait while mount | grep $mntpoint | grep -q /dev/md; do umount $mntpoint || sleep 1 done mdconfig -d -u $mdstart rm -f /tmp/fts exit EOF #include #include #include #include #include #include #include #include #include #include int test(char *path) { FTS *fts; FTSENT *p; int ftsoptions; char *args[2]; ftsoptions = FTS_PHYSICAL; args[0] = path; args[1] = 0; if ((fts = fts_open(args, ftsoptions, NULL)) == NULL) err(1, "fts_open"); while ((p = fts_read(fts)) != NULL) { switch (p->fts_info) { case FTS_F: /* Ignore. */ break; case FTS_D: /* Ignore. */ break; case FTS_DP: break; case FTS_DC: /* Ignore. */ break; case FTS_SL: /* Ignore. */ break; case FTS_DNR: /* Warn, continue. */ case FTS_ERR: case FTS_NS: case FTS_DEFAULT: break; default: printf("%s: default, %d\n", getprogname(), p->fts_info); break; } } if (errno != 0 && errno != ENOENT) err(1, "fts_read"); if (fts_close(fts) == -1) err(1, "fts_close()"); return (0); } int main(int argc, char **argv) { int i; if (argc != 2) errx(1, "Usage: %s ", argv[0]); alarm(600); for (i = 0; i < 100; i++) test(argv[1]); return (0); } Index: user/pho/stress2/misc/kevent4.sh =================================================================== --- user/pho/stress2/misc/kevent4.sh (revision 296724) +++ user/pho/stress2/misc/kevent4.sh (revision 296725) @@ -1,202 +1,203 @@ #!/bin/sh # # Copyright (c) 2008 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$ # # Test scenario by kib@ . ../default.cfg odir=`pwd` cd /tmp sed '1,/^EOF/d' < $odir/$0 > kevent4.c mycc -o kevent4 -Wall kevent4.c -pthread rm -f kevent4.c cd $odir export runRUNTIME=3m (cd ..; ./run.sh > /dev/null 2>&1) & rpid=$! (cd $RUNDIR; /tmp/kevent4 $rpid > /dev/null) & sleep 120 kill $rpid ../tools/killall.sh > /dev/null 2>&1 kill $! +wait rm -f /tmp/kevent4 exit EOF // $FreeBSD$ #include #include #include #include #include #include #include #ifndef true # define true 1 #endif int kq; void err(const char *msg, int err_no) { fprintf(stderr, "%s: %s\n", msg, strerror(err_no)); exit(1); } void init_kq() { kq = kqueue(); if (kq == -1) err("kqueue", errno); } void add_watch(pid_t pid) { struct kevent kev; bzero(&kev, sizeof(kev)); kev.ident = pid; kev.flags = EV_ADD | EV_ENABLE; kev.filter = EVFILT_PROC; kev.fflags = NOTE_EXIT | NOTE_FORK | NOTE_EXEC | NOTE_TRACK; while (true) { int res = kevent(kq, &kev, 1, NULL, 0, NULL); if (res == -1) { if (errno == EINTR) continue; if (errno == ESRCH) break; int err_no = errno; char msg[64]; snprintf(msg, sizeof(msg), "kevent - add watch for pid %u", pid); err(msg, err_no); } else break; } } void del_watch(pid_t pid) { struct kevent kev; bzero(&kev, sizeof(kev)); kev.ident = pid; kev.flags = EV_DELETE; kev.filter = EVFILT_PROC; while (true) { int res = kevent(kq, &kev, 1, NULL, 0, NULL); if (res == -1) { if (errno == EINTR) continue; if (errno == ESRCH) break; int err_no = errno; char msg[64]; snprintf(msg, sizeof(msg), "kevent - del watch for pid %u", pid); err(msg, err_no); } else break; } } void polling() { struct kevent kev[10]; pid_t pid; int i; while (true) { bzero(&kev, sizeof(kev)); int res = kevent(kq, NULL, 0, kev, sizeof(kev) / sizeof(kev[0]), NULL); if (res == -1) { if (errno == EINTR) continue; if (errno == ESRCH) continue; err("kevent", errno); } for (i = 0; i < res; i++) { pid = kev[i].ident; if (kev[i].fflags & NOTE_CHILD) { add_watch(pid); printf("%u - new process, parent %u\n", pid, (unsigned int)kev[i].data); } if (kev[i].fflags & NOTE_FORK) { printf("%u forked\n", pid); } if (kev[i].fflags & NOTE_EXEC) { printf("%u called exec\n", pid); } if (kev[i].fflags & NOTE_EXIT) { printf("%u exited\n", pid); // del_watch(pid); } if (kev[i].fflags & NOTE_TRACK) { printf("%u forked - track\n", pid); } if (kev[i].fflags & NOTE_TRACKERR) { fprintf(stderr, "%u - track error\n", pid); } } } } int main(int argc, char *argv[]) { if (argc != 2) { fprintf(stderr, "pid ?\n"); return (2); } pid_t parent = atoi(argv[1]); init_kq(); add_watch(parent); polling(); return (0); } Index: user/pho/stress2/misc/machipc.sh =================================================================== --- user/pho/stress2/misc/machipc.sh (revision 296724) +++ user/pho/stress2/misc/machipc.sh (revision 296725) @@ -1,185 +1,186 @@ #!/bin/sh # # Copyright (c) 2015 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$ # # Threaded Mach IPC test scenario # https://people.freebsd.org/~pho/stress/log/kip014.txt ps -p1 | grep -q launchd || exit 0 odir=`pwd` cd /tmp sed '1,/^EOF/d' < $odir/$0 > machipc.c cc -o machipc -Wall -Wextra -O2 -g machipc.c -lmach -lpthread || exit 1 rm machipc.c cd $odir (cd ../testcases/swap; ./swap -t 20m -i 20 -h -v) > /dev/null 2>&1 & sleep 5 /tmp/machipc pkill swap +wait rm -f /tmp/machipc exit 0 EOF #include #include #include #include #include #include #include #include typedef struct { unsigned int msgt_name : 8, msgt_size : 8, msgt_number : 12, msgt_inline : 1, msgt_longform : 1, msgt_deallocate : 1, msgt_unused : 1; } mach_msg_type_t; struct integer_message { mach_msg_header_t head; mach_msg_type_t type; int inline_integer; }; struct message_recv { mach_msg_header_t head; mach_msg_type_t type; int inline_integer; mach_msg_trailer_t trailer; }; mach_port_t bootstrap_port; #define MACH_MSG_TYPE_INTEGER_32 2 #define N 100000000 static void error(int exitcode, int macherr, const char *funcname) { printf("%s failed with %x\n", funcname, macherr); exit(exitcode); } void * client(void *arg) { mach_port_t port = *(mach_port_t *) arg; struct message_recv message = {}; int err, i; message.head.msgh_local_port = port; message.head.msgh_size = sizeof(message); for (i = 0; i < N; i++) { /* Receive a message */ err = mach_msg(&message.head, /* The header */ MACH_RCV_MSG, /* Flags */ 0, /* Send size */ sizeof(message), /* Max receive size */ port, /* Receive port */ MACH_MSG_TIMEOUT_NONE, /* No timeout */ MACH_PORT_NULL); /* No notification */ if (err) error(1, err, "server mach_msg MACH_RCV_MSG"); if (message.inline_integer != i) errx(1, "FAIL message.inline_integer = %d, i = %d", message.inline_integer, i); } return(0); } int main(void) { pthread_t ptd; mach_port_t port; struct integer_message message; int err, i; /* Allocate a port */ err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port); if (err) error(1, err, "mach_port_allocate"); err = mach_port_insert_right(mach_task_self(), port, port, MACH_MSG_TYPE_MAKE_SEND); if (err) error(10, err, "mach_port_insert_right"); if ((err = pthread_create(&ptd, NULL, client, &port)) != 0) { errc(1, err, "pthread_create failed"); } /* Fill the header fields : */ message.head.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, MACH_MSG_TYPE_MAKE_SEND); message.head.msgh_size = sizeof( struct integer_message ); message.head.msgh_local_port = MACH_PORT_NULL; message.head.msgh_remote_port = port; message.head.msgh_id = 0; /* Message id */ message.head.msgh_size = sizeof(message); /* Message size */ /* Set the message type */ message.type.msgt_name = MACH_MSG_TYPE_INTEGER_32; message.type.msgt_size = sizeof(message); message.type.msgt_number = 1; message.type.msgt_inline = TRUE; message.type.msgt_longform = FALSE; message.type.msgt_deallocate = FALSE; for (i = 0; i < N; i++) { message.inline_integer = i; /* Send the message */ err = mach_msg(&message.head, /* The header */ MACH_SEND_MSG, /* Flags */ sizeof(message), /* Send size */ 0, /* Max receive Size */ port, /* Send port */ MACH_MSG_TIMEOUT_NONE, /* No timeout */ MACH_PORT_NULL); /* No notification */ if (err) error(3, err, "client mach_msg"); } pthread_join(ptd, NULL); return (0); } Index: user/pho/stress2/misc/mlockall4.sh =================================================================== --- user/pho/stress2/misc/mlockall4.sh (revision 296724) +++ user/pho/stress2/misc/mlockall4.sh (revision 296725) @@ -1,67 +1,68 @@ #!/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$ # # mlockall(2) / nullfs(5) scenario causes: # http://people.freebsd.org/~pho/stress/log/kostik619.txt # kern/182661, fixed in r256211. . ../default.cfg [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 odir=`pwd` cd /tmp sed '1,/^EOF/d' < $odir/$0 > mlockall4.c mycc -o mlockall4 -Wall -Wextra mlockall4.c || exit 1 rm -f mlockall4.c mount | grep -q "on $mntpoint " && umount -f $mntpoint mount -t nullfs /tmp $mntpoint /mnt/mlockall4 & sleep 2 umount -f $mntpoint +wait rm -f /tmp/mlockall4 exit EOF #include #include #include #include int main(void) { if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) err(1, "mlockall(MCL_CURRENT | MCL_FUTURE)"); sleep(5); return (0); } Index: user/pho/stress2/misc/mountro.sh =================================================================== --- user/pho/stress2/misc/mountro.sh (revision 296724) +++ user/pho/stress2/misc/mountro.sh (revision 296725) @@ -1,67 +1,68 @@ #!/bin/sh # # Copyright (c) 2008-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$ # . ../default.cfg [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 D=$diskimage dede $D 1m 128 || exit mount | grep "$mntpoint" | grep -q /md && umount -f ${mntpoint} mdconfig -l | grep -q ${mdstart} && mdconfig -d -u $mdstart mdconfig -a -t vnode -f $D -u $mdstart bsdlabel -w md${mdstart} auto newfs $newfs_flags md${mdstart}${part} > /dev/null 2>&1 mount /dev/md${mdstart}${part} $mntpoint mkdir ${mntpoint}/stressX chmod 777 ${mntpoint}/stressX export RUNDIR=${mntpoint}/stressX export runRUNTIME=4m (cd ..; ./run.sh disk.cfg > /dev/null 2>&1) & sleep 30 for i in `jot 10`; do mount $mntpoint -u -o ro > /dev/null 2>&1 sleep 3 mount $mntpoint -u -o rw > /dev/null 2>&1 sleep 3 done df -i $mntpoint umount -f $mntpoint > /dev/null 2>&1 mdconfig -d -u $mdstart rm -f $D kill `ps | grep run.sh | grep -v grep | awk '{print $1}'` +wait Index: user/pho/stress2/misc/nfs3.sh =================================================================== --- user/pho/stress2/misc/nfs3.sh (revision 296724) +++ user/pho/stress2/misc/nfs3.sh (revision 296725) @@ -1,60 +1,61 @@ #!/bin/sh # # Copyright (c) 2008-2013 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: neg mount point vnode list size [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg [ -z "$nfs_export" ] && exit 0 ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1 || exit 0 [ ! -d $mntpoint ] && mkdir $mntpoint mount | grep "$mntpoint" | grep nfs > /dev/null && umount $mntpoint mount -t nfs -o tcp -o retrycnt=3 -o intr -o soft -o rw $nfs_export $mntpoint sleep 1 rm -rf $mntpoint/stressX/* rm -rf /tmp/stressX.control export RUNDIR=$mntpoint/nfs/stressX [ ! -d $RUNDIR ] && mkdir -p $RUNDIR export runRUNTIME=1m rm -rf /tmp/stressX.control/* su $testuser -c "(cd ..; ./run.sh io.cfg > /dev/null 2>&1)" & sleep 50 while mount | grep -q "on $mntpoint "; do umount -f $mntpoint || sleep 1 done kill -9 $! ../tools/killall.sh +wait Index: user/pho/stress2/misc/nfs4.sh =================================================================== --- user/pho/stress2/misc/nfs4.sh (revision 296724) +++ user/pho/stress2/misc/nfs4.sh (revision 296725) @@ -1,59 +1,60 @@ #!/bin/sh # # Copyright (c) 2008-2013 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: vm_fault: fault on nofault entry, from vfs_stdcheckexp+0x74 [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg [ -z "$nfs_export" ] && exit 0 ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1 || exit 0 [ ! -d $mntpoint ] && mkdir $mntpoint mount | grep "$mntpoint" | grep nfs > /dev/null && umount $mntpoint mount -t nfs -o tcp -o retrycnt=3 -o intr -o soft -o rw $nfs_export $mntpoint rm -rf $mntpoint/stressX/* rm -rf /tmp/stressX.control export RUNDIR=$mntpoint/nfs/stressX [ ! -d $RUNDIR ] && mkdir -p $RUNDIR export runRUNTIME=3m rm -rf /tmp/stressX.control/* su $testuser -c '(cd ..; ./run.sh all.cfg)' & sleep 60 while mount | grep -q $mntpoint; do umount -f $mntpoint > /dev/null 2>&1 done kill -9 $! ../tools/killall.sh +wait Index: user/pho/stress2/misc/nfs5.sh =================================================================== --- user/pho/stress2/misc/nfs5.sh (revision 296724) +++ user/pho/stress2/misc/nfs5.sh (revision 296725) @@ -1,66 +1,67 @@ #!/bin/sh # # Copyright (c) 2008-2013 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$ # . ../default.cfg [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 D=$diskimage dede $D 1m 128 || exit mount | grep "${mntpoint}2" | grep nfs > /dev/null && umount -f ${mntpoint}2 mount | grep "$mntpoint" | grep /md > /dev/null && umount -f ${mntpoint} mdconfig -l | grep -q ${mdstart} && mdconfig -d -u $mdstart mdconfig -a -t vnode -f $D -u $mdstart bsdlabel -w md${mdstart} auto newfs $newfs_flags md${mdstart}${part} > /dev/null mount /dev/md${mdstart}${part} $mntpoint mkdir ${mntpoint}/stressX chmod 777 ${mntpoint}/stressX [ ! -d ${mntpoint}2 ] && mkdir ${mntpoint}2 chmod 777 ${mntpoint}2 mount -t nfs -o tcp -o retrycnt=3 -o intr -o soft -o rw 127.0.0.1:/$mntpoint ${mntpoint}2 export RUNDIR=${mntpoint}2/stressX export runRUNTIME=4m su $testuser -c "(cd ..; ./run.sh disk.cfg > /dev/null 2>&1)" & sleep 60 umount -f $mntpoint > /dev/null 2>&1 umount -f ${mntpoint}2 > /dev/null 2>&1 mdconfig -d -u $mdstart rm -f $D kill `ps | grep run.sh | grep -v grep | awk '{print $1}'` +wait Index: user/pho/stress2/misc/nfs6.sh =================================================================== --- user/pho/stress2/misc/nfs6.sh (revision 296724) +++ user/pho/stress2/misc/nfs6.sh (revision 296725) @@ -1,79 +1,80 @@ #!/bin/sh # # Copyright (c) 2008-2013 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: vn_finished_write: neg cnt # http://people.freebsd.org/~pho/stress/log/kostik500.txt # http://people.freebsd.org/~pho/stress/log/nfs6.txt . ../default.cfg [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 grep -q $mntpoint /etc/exports || { echo "$mntpoint missing from /etc/exports"; exit 0; } D=$diskimage dede $D 1m 128 || exit mount | grep "${mntpoint}2" | grep nfs > /dev/null && umount -f ${mntpoint}2 mount | grep "$mntpoint" | grep /md > /dev/null && umount -f ${mntpoint} mdconfig -l | grep -q ${mdstart} && mdconfig -d -u $mdstart mdconfig -a -t vnode -f $D -u $mdstart bsdlabel -w md${mdstart} auto newfs $newfs_flags md${mdstart}${part} > /dev/null mount /dev/md${mdstart}${part} $mntpoint mkdir ${mntpoint}/stressX chmod 777 ${mntpoint}/stressX [ ! -d ${mntpoint}2 ] && mkdir ${mntpoint}2 chmod 777 ${mntpoint}2 mount -t nfs -o tcp -o retrycnt=3 -o intr -o soft -o rw 127.0.0.1:$mntpoint ${mntpoint}2 export RUNDIR=${mntpoint}2/stressX export runRUNTIME=4m su $testuser -c "(cd ..; ./run.sh disk.cfg > /dev/null 2>&1)" & sleep 60 for i in `jot 10`; do umount -f $mntpoint > /dev/null 2>&1 sleep 1 mount /dev/md${mdstart}${part} $mntpoint sleep 1 done umount -f $mntpoint > /dev/null 2>&1 umount -f ${mntpoint}2 > /dev/null 2>&1 mdconfig -d -u $mdstart rm -f $D kill `ps | grep run.sh | grep -v grep | awk '{print $1}'` +wait Index: user/pho/stress2/misc/nfs9.sh =================================================================== --- user/pho/stress2/misc/nfs9.sh (revision 296724) +++ user/pho/stress2/misc/nfs9.sh (revision 296725) @@ -1,69 +1,70 @@ #!/bin/sh # # Copyright (c) 2008-2013 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$ # # Copy of nfs4.sh, where it was discovered that a missing killall.sh script # turned up quite a few new panics. For example: # vfs_mount_destroy: nonzero writeopcount # Lock nfs not locked @ kern/vfs_default.c:462 # Assertion x == LK_SHARERS_LOCK(1) failed at kern/kern_lock.c:236 [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg [ -z "$nfs_export" ] && exit 0 ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1 || exit 0 [ ! -d $mntpoint ] && mkdir $mntpoint for i in `jot 10`; do mount | grep "on $mntpoint " | grep -q nfs && umount $mntpoint mount -t nfs -o tcp -o retrycnt=3 -o intr -o soft \ -o rw $nfs_export $mntpoint sleep .5 export RUNDIR=$mntpoint/nfs9/stressX rm -rf $RUNDIR mkdir -p $RUNDIR chmod 777 $RUNDIR export runRUNTIME=3m rm -rf /tmp/stressX.control/* su $testuser -c '(cd ..; ./run.sh all.cfg) > /dev/null 2>&1' & sleep 60 while mount | grep -q $mntpoint; do umount -f $mntpoint > /dev/null 2>&1 done kill -9 $! + wait done ../tools/killall.sh rm -rf /tmp/nfs9 Index: user/pho/stress2/misc/quota11.sh =================================================================== --- user/pho/stress2/misc/quota11.sh (revision 296724) +++ user/pho/stress2/misc/quota11.sh (revision 296725) @@ -1,63 +1,64 @@ #!/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$ # # "panic: share->excl" seen. # http://people.freebsd.org/~pho/stress/log/kostik715.txt # Fixed in r270795 and r270797 # Test scenario by Hiroki Sato [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg mount | grep "on $mntpoint " | grep -q md${mdstart}$part && umount $mntpoint [ -c /dev/md$mdstart ] && mdconfig -d -u $mdstart mdconfig -a -t swap -s 1g -u $mdstart || exit 1 bsdlabel -w md$mdstart auto newfs $newfs_flags md${mdstart}$part > /dev/null export PATH_FSTAB=/tmp/fstab trap "rm -f $PATH_FSTAB" 0 echo "/dev/md${mdstart}$part $mntpoint ufs rw,userquota 2 2" > $PATH_FSTAB mount $mntpoint edquota -u -f $mntpoint -e $mntpoint:1000:2000:100:200 root quotaon $mntpoint while true; do repquota -av > /dev/null; done & dd if=/dev/random of=$mntpoint/foo.data bs=512 count=1024x1024 2>&1 | egrep -v "trans|record" kill $! +wait while mount | grep "on $mntpoint " | grep -q /dev/md; do umount $mntpoint || sleep 1 done mdconfig -d -u $mdstart Index: user/pho/stress2/misc/quota6.sh =================================================================== --- user/pho/stress2/misc/quota6.sh (revision 296724) +++ user/pho/stress2/misc/quota6.sh (revision 296725) @@ -1,66 +1,67 @@ #!/bin/sh # # Copyright (c) 2008 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 # Deadlock in umount(1) while out of disk space D=$diskimage truncate -s 250M $D mount | grep $mntpoint | grep -q md${mdstart}$part && umount $mntpoint mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart mdconfig -a -t vnode -f $D -u $mdstart bsdlabel -w md$mdstart auto newfs $newfs_flags md${mdstart}$part > /dev/null export PATH_FSTAB=/tmp/fstab echo "/dev/md${mdstart}${part} ${mntpoint} ufs rw,userquota 2 2" > $PATH_FSTAB mount $mntpoint edquota -u -f $mntpoint -e $mntpoint:850000:900000:130000:140000 root > /dev/null 2>&1 quotaon $mntpoint export RUNDIR=$mntpoint/stressX ../testcases/rw/rw -t 10m -i 200 -h -n & pid=$! for i in `jot 5`; do echo "`date '+%T'` mksnap_ffs $mntpoint $mntpoint/.snap/snap$i" mksnap_ffs $mntpoint $mntpoint/.snap/snap$i done for i in `jot 5`; do rm -f $mntpoint/.snap/snap1 done kill $pid +wait while mount | grep -q ${mntpoint}; do umount ${mntpoint} || sleep 1 done mdconfig -d -u $mdstart rm -f $D $PATH_FSTAB Index: user/pho/stress2/misc/sendfile2.sh =================================================================== --- user/pho/stress2/misc/sendfile2.sh (revision 296724) +++ user/pho/stress2/misc/sendfile2.sh (revision 296725) @@ -1,144 +1,145 @@ #!/bin/sh # # Copyright (c) 2010 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$ # # Test scenario for sendfile corruption of read only input file # Scenario by Ming Fu . ../default.cfg odir=`pwd` cd /tmp sed '1,/^EOF/d' < $odir/$0 > sendfile2.c mycc -o sendfile2 -Wall sendfile2.c rm -f sendfile2.c [ -d "$RUNDIR" ] || mkdir -p $RUNDIR cd $RUNDIR dd if=/dev/random of=large bs=1m count=3 2>&1 | egrep -v "records|transferred" md1=`md5 large` nc -l 7000 > lf & sleep 0.1 /tmp/sendfile2 kill $! 2>/dev/null +wait md2=`md5 large` [ "$md1" != "$md2" ] && printf "%s\n%s\n" "$md1" "$md2" rm -f /tmp/sendfile2 large lf exit EOF #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include int main () { int s, f; struct sockaddr_in addr; struct hostent *hostent; int flags; char str[32]="\r\n800\r\n"; char *p = str; struct stat sb; int n; fd_set wset; int64_t size; off_t sbytes; off_t sent = 0; int chunk; alarm(120); s = socket(AF_INET, SOCK_STREAM, 0); bzero(&addr, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(7000); hostent = gethostbyname ("localhost"); memcpy (&addr.sin_addr.s_addr, hostent->h_addr, sizeof (struct in_addr)); n = connect(s, (struct sockaddr *)&addr, sizeof (addr)); if (n < 0) warn ("fail to connect"); flags = fcntl(s, F_GETFL); flags |= O_NONBLOCK; fcntl(s, F_SETFL); f = open("large", O_RDONLY); if (f < 0) warn("fail to open file"); n = fstat(f, &sb); if (n < 0) warn("fstat failed"); size = sb.st_size; chunk = 0; while (size > 0) { FD_ZERO(&wset); FD_SET(s, &wset); n = select(f+1, NULL, &wset, NULL, NULL); if (n < 0) continue; if (chunk > 0) { sbytes = 0; n = sendfile(f, s, sent, chunk, NULL, &sbytes, 0); if (n < 0) continue; chunk -= sbytes; size -= sbytes; sent += sbytes; continue; } if (size > 2048) chunk = 2048; else chunk = size; n = sprintf(str, "\r\n%x\r\n", 2048); p = str; write(s, p, n); } return (0); } Index: user/pho/stress2/misc/sendfile6.sh =================================================================== --- user/pho/stress2/misc/sendfile6.sh (revision 296724) +++ user/pho/stress2/misc/sendfile6.sh (revision 296725) @@ -1,256 +1,257 @@ #!/bin/sh # # Copyright (c) 2013 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$ # # Test scenario by Nate Eldredge neldredge math ucsdnedu # kern/127213: [tmpfs] sendfile on tmpfs data corruption # Variation of tmpfs7.sh where UFS is used instead of tmpfs. [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg set -e odir=`pwd` cd /tmp cat > sendfile6_server.c < #include #include #include #include "util.h" int main(int argc, char *argv[]) { int f, listener, connection; if (argc < 3) { fprintf(stderr, "Usage: %s filename socketname\n", argv[0]); exit(1); } if ((f = open(argv[1], O_RDONLY)) < 0) { perror(argv[1]); exit(1); } if ((listener = listen_unix_socket(argv[2])) < 0) { exit(1); } if ((connection = accept_unix_socket(listener)) >= 0) { real_sendfile(f, connection); } return 0; } EOF cat > sendfile6_client.c < #include #include #include #include "util.h" int main(int argc, char *argv[]) { int s; if (argc < 2) { fprintf(stderr, "Usage: %s socketname\n", argv[0]); exit(1); } if ((s = connect_unix_socket(argv[1])) < 0) { exit(1); } fake_sendfile(s, 1); return 0; } EOF cat > util.c < #include #include #include #include #include #include #include #include #include int create_unix_socket(void) { int fd; if ((fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) { perror("socket"); return -1; } return fd; } int make_unix_sockaddr(const char *pathname, struct sockaddr_un *sa) { memset(sa, 0, sizeof(*sa)); sa->sun_family = PF_LOCAL; if (strlen(pathname) + 1 > sizeof(sa->sun_path)) { // fprintf(stderr, "%s: pathname too long (max %lu)\n", // pathname, sizeof(sa->sun_path)); errno = ENAMETOOLONG; return -1; } strcpy(sa->sun_path, pathname); return 0; } static char *sockname; void delete_socket(void) { unlink(sockname); } int listen_unix_socket(const char *path) { int fd; struct sockaddr_un sa; if (make_unix_sockaddr(path, &sa) < 0) return -1; if ((fd = create_unix_socket()) < 0) return -1; if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0) { perror("bind"); close(fd); return -1; } sockname = strdup(path); atexit(delete_socket); if (listen(fd, 5) < 0) { perror("listen"); close(fd); return -1; } return fd; } int accept_unix_socket(int fd) { int s; if ((s = accept(fd, NULL, 0)) < 0) { perror("accept"); return -1; } return s; } int connect_unix_socket(const char *path) { int fd; struct sockaddr_un sa; if (make_unix_sockaddr(path, &sa) < 0) return -1; if ((fd = create_unix_socket()) < 0) return -1; if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0) { perror("connect"); return -1; } return fd; } #define BUFSIZE 65536 int fake_sendfile(int from, int to) { char buf[BUFSIZE]; int v; int sent = 0; while ((v = read(from, buf, BUFSIZE)) > 0) { int d = 0; while (d < v) { int w = write(to, buf, v - d); if (w <= 0) { perror("write"); return -1; } d += w; sent += w; } } if (v != 0) { perror("read"); return -1; } return sent; } int real_sendfile(int from, int to) { int v; v = sendfile(from, to, 0, 0, NULL, NULL, 0); if (v < 0) { perror("sendfile"); } return v; } EOF cat > util.h < #include #include #include #include #include #include int create_unix_socket(void); int make_unix_sockaddr(const char *pathname, struct sockaddr_un *sa); int listen_unix_socket(const char *path); int accept_unix_socket(int fd); int connect_unix_socket(const char *path); int fake_sendfile(int from, int to); int real_sendfile(int from, int to); EOF mycc -c -Wall -Wextra -O2 util.c mycc -o sendfile6_server -Wall -Wextra -O2 sendfile6_server.c util.o mycc -o sendfile6_client -Wall -Wextra -O2 sendfile6_client.c util.o rm -f sendfile6_server.c sendfile6_client.c util.c util.o util.h mysocket mount | grep "on $mntpoint " | grep -q /dev/md && umount -f $mntpoint mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart mdconfig -a -t swap -s 1g -u $mdstart || exit 1 bsdlabel -w md$mdstart auto newfs $newfs_flags md${mdstart}$part > /dev/null mount /dev/md${mdstart}$part $mntpoint dd if=/dev/random of=$mntpoint/data bs=123456 count=1 > /dev/null 2>&1 ./sendfile6_server $mntpoint/data mysocket & sleep 0.2 ./sendfile6_client mysocket > data.$$ +wait cmp $mntpoint/data data.$$ || { echo "FAIL Data mismatch"; ls -l $mntpoint/data data.$$; } rm -f data.$$ sendfile6_server sendfile6_client mysocket while mount | grep "on $mntpoint " | grep -q /dev/md; do umount $mntpoint || sleep 1 done mdconfig -d -u $mdstart Index: user/pho/stress2/misc/signal0.sh =================================================================== --- user/pho/stress2/misc/signal0.sh (revision 296724) +++ user/pho/stress2/misc/signal0.sh (revision 296725) @@ -1,94 +1,95 @@ #!/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$ # # Zero signal number seen. # Test scenario by Vitaly Magerya # http://people.freebsd.org/~pho/stress/log/kostik646.txt # Panic fixed in r258497 # Signal number fixed in r258499 # panic: vm_fault: fault on nofault entry, addr: cdbbe000 # https://people.freebsd.org/~pho/stress/log/kostik838.txt # Fixed by r289661. dir=/tmp odir=`pwd` cd $dir sed '1,/^EOF/d' < $odir/$0 > $dir/signal0.c c99 -o signal0 signal0.c -lpthread || exit 1 rm -f signal0.c cd $odir (cd ../testcases/swap; ./swap -t 5m -i 20 -h -v) > /dev/null 2>&1 & for i in `jot 500`; do /tmp/signal0 done while pkill -9 swap; do : done +wait rm -f /tmp/signal0 exit EOF #include #include #include #include void signal_handler(int signum, siginfo_t *si, void *context) { if (signum != SIGUSR1) { printf("FAIL bad signal, signum=%d\n", signum); exit(1); } } void *thread_func(void *arg) { return arg; } int main(void) { struct sigaction sa = { 0 }; sa.sa_flags = SA_SIGINFO; sa.sa_sigaction = signal_handler; if (sigfillset(&sa.sa_mask) != 0) abort(); if (sigaction(SIGUSR1, &sa, NULL) != 0) abort(); for (int i = 0; i < 10000; i++) { pthread_t t; pthread_create(&t, NULL, thread_func, NULL); pthread_kill(t, SIGUSR1); /* Side note. pthread_kill(3) call behaviour is undefined if pthread_create(3) in the line before failed. */ } return 0; } Index: user/pho/stress2/misc/sigxcpu.sh =================================================================== --- user/pho/stress2/misc/sigxcpu.sh (revision 296724) +++ user/pho/stress2/misc/sigxcpu.sh (revision 296725) @@ -1,154 +1,155 @@ #!/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 # "panic: softdep_deallocate_dependencies: dangling deps" seen: # http://people.freebsd.org/~pho/stress/log/sigxcpu7.txt . ../default.cfg here=`pwd` cd /tmp sed '1,/^EOF/d' < $here/$0 > sigxcpu.c mycc -o sigxcpu -Wall -Wextra sigxcpu.c rm -f sigxcpu.c cd $here mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart mdconfig -a -t swap -s 4g -u $mdstart || exit 1 bsdlabel -w md$mdstart auto newfs $newfs_flags md${mdstart}$part > /dev/null mount /dev/md${mdstart}$part $mntpoint chmod 777 $mntpoint export runRUNTIME=4m export RUNDIR=$mntpoint/stressX set `df -ik /mnt | tail -1 | awk '{print $4,$7}'` export KBLOCKS=$(($1 / 4)) export INODES=$(($2 / 4)) su $testuser -c 'ulimit -t 3; cd ..; ./run.sh marcus.cfg' > /dev/null & sleep 2 for i in `jot 10`; do /tmp/sigxcpu $mntpoint done kill $! ../tools/killall.sh ../tools/killall.sh +wait while mount | grep $mntpoint | grep -q /dev/md; do umount $mntpoint || sleep 1 done mdconfig -d -u $mdstart rm -f /tmp/sigxcpu exit EOF #include #include #include #include #include #include #include #include #include #include static void hand(int i __unused) { /* handler */ _exit(1); } int test(char *path) { FTS *fts; FTSENT *p; int ftsoptions; char *args[2]; ftsoptions = FTS_PHYSICAL; args[0] = path; args[1] = 0; if ((fts = fts_open(args, ftsoptions, NULL)) == NULL) err(1, "fts_open"); while ((p = fts_read(fts)) != NULL) { switch (p->fts_info) { case FTS_F: /* Ignore. */ break; case FTS_D: /* Ignore. */ break; case FTS_DP: break; case FTS_DC: /* Ignore. */ break; case FTS_SL: /* Ignore. */ break; case FTS_DNR: /* Warn, continue. */ case FTS_ERR: case FTS_NS: case FTS_DEFAULT: break; default: printf("%s: default, %d\n", getprogname(), p->fts_info); break; } } if (errno != 0 && errno != ENOENT) err(1, "fts_read"); if (fts_close(fts) == -1) err(1, "fts_close()"); return (0); } int main(int argc, char **argv) { int i; if (argc != 2) errx(1, "Usage: %s ", argv[0]); signal(SIGALRM, hand); alarm(20); for (i = 0; i < 100; i++) test(argv[1]); return (0); } Index: user/pho/stress2/misc/snap2-1.sh =================================================================== --- user/pho/stress2/misc/snap2-1.sh (revision 296724) +++ user/pho/stress2/misc/snap2-1.sh (revision 296725) @@ -1,61 +1,62 @@ #!/bin/sh # # Copyright (c) 2008, 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$ # [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg # Regression test: Delete an active md device # # panic(c088cd33,deadc000,c0943aa0,0,c08753e1) at panic+0x14b # vm_fault(c1060000,deadc000,1,0,c54de480) at vm_fault+0x1e0 # trap_pfault(e76728b8,0,deadc112) at trap_pfault+0x137 # trap(8,c0870028,28,deadc0de,deadc0de) at trap+0x355 # calltrap() at calltrap+0x5 # --- trap 0xc, eip = 0xc060bcfb, esp = 0xe76728f8, ebp = 0xe767291c --- # g_io_request(c53ff7bc,c5051d40,d8c72408,c54ca110,e7672950) at g_io_request+0x5f mount | grep -q "on /tmp (ufs," || exit 0 rm -f /tmp/.snap/stress2 [ -d /tmp/.snap ] || mkdir /tmp/.snap trap "rm -f /tmp/.snap/stress2" 0 mount | grep "$mntpoint" | grep -q md$mdstart && umount $mntpoint mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart mksnap_ffs /tmp /tmp/.snap/stress2 mdconfig -a -t vnode -o readonly -f /tmp/.snap/stress2 -u $mdstart mount -o ro /dev/md$mdstart $mntpoint ls -lR $mntpoint > /dev/null 2>&1 & mdconfig -d -u $mdstart > /dev/null 2>&1 umount -f $mntpoint mdconfig -d -u $mdstart rm -f /tmp/.snap/stress2 +wait Index: user/pho/stress2/misc/snap2.sh =================================================================== --- user/pho/stress2/misc/snap2.sh (revision 296724) +++ user/pho/stress2/misc/snap2.sh (revision 296725) @@ -1,61 +1,62 @@ #!/bin/sh # # Copyright (c) 2008 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 # Regression test: Delete an active md device # # panic(c088cd33,deadc000,c0943aa0,0,c08753e1) at panic+0x14b # vm_fault(c1060000,deadc000,1,0,c54de480) at vm_fault+0x1e0 # trap_pfault(e76728b8,0,deadc112) at trap_pfault+0x137 # trap(8,c0870028,28,deadc0de,deadc0de) at trap+0x355 # calltrap() at calltrap+0x5 # --- trap 0xc, eip = 0xc060bcfb, esp = 0xe76728f8, ebp = 0xe767291c --- # g_io_request(c53ff7bc,c5051d40,d8c72408,c54ca110,e7672950) at g_io_request+0x5f . ../default.cfg mount | grep -q "on /tmp (ufs," || exit 0 rm -f /tmp/.snap/stress2 trap "rm -f /tmp/.snap/stress2" 0 mount | grep "${mntpoint}" | grep -q md${mdstart} && umount -f ${mntpoint} mdconfig -l | grep -q md${mdstart} && mdconfig -d -u ${mdstart} mksnap_ffs /tmp /tmp/.snap/stress2 mdconfig -a -t vnode -f /tmp/.snap/stress2 -u $mdstart -o readonly mount -r /dev/md${mdstart} ${mntpoint} ls -lR > /dev/null 2>&1 & mdconfig -d -u $mdstart > /dev/null 2>&1 umount ${mntpoint} > /dev/null 2>&1 umount -f ${mntpoint} > /dev/null 2>&1 mdconfig -d -u $mdstart rm -f /tmp/.snap/stress2 +wait Index: user/pho/stress2/misc/snap7.sh =================================================================== --- user/pho/stress2/misc/snap7.sh (revision 296724) +++ user/pho/stress2/misc/snap7.sh (revision 296725) @@ -1,60 +1,61 @@ #!/bin/sh # # Copyright (c) 2008, 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$ # [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg # Test with unmount and paralless access to mountpoint # 20070508 page fault in g_io_request+0xa6 mount | grep -q "on /tmp (ufs," || exit 0 mount | grep -q "/dev/md$mdstart on $mntpoint" && umount $mntpoint rm -f /tmp/.snap/stress2.1 trap "rm -f /tmp/.snap/stress2.1" 0 mount | grep "$mntpoint" | grep -q md$mdstart && umount $mntpoint mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart start=`date '+%s'` while [ `date '+%s'` -lt $((start + 1200)) ]; do mksnap_ffs /tmp /tmp/.snap/stress2.1 mdconfig -a -t vnode -f /tmp/.snap/stress2.1 -u $mdstart -o readonly sh -c "while true; do ls $mntpoint > /dev/null;done" & for i in `jot 64`; do mount -o ro /dev/md$mdstart $mntpoint 2>/dev/null umount $mntpoint 2>/dev/null done kill $! + wait while mount | grep -q "/dev/md$mdstart on $mntpoint"; do umount $mntpoint 2>/dev/null done mdconfig -d -u $mdstart rm -f /tmp/.snap/stress2.1 done Index: user/pho/stress2/misc/tmpfs7.sh =================================================================== --- user/pho/stress2/misc/tmpfs7.sh (revision 296724) +++ user/pho/stress2/misc/tmpfs7.sh (revision 296725) @@ -1,250 +1,251 @@ #!/bin/sh # # Copyright (c) 2013 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$ # # Test scenario by Nate Eldredge neldredge math ucsdnedu # kern/127213: [tmpfs] sendfile on tmpfs data corruption [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg set -e odir=`pwd` cd /tmp cat > server.c < #include #include #include #include "util.h" int main(int argc, char *argv[]) { int f, listener, connection; if (argc < 3) { fprintf(stderr, "Usage: %s filename socketname\n", argv[0]); exit(1); } if ((f = open(argv[1], O_RDONLY)) < 0) { perror(argv[1]); exit(1); } if ((listener = listen_unix_socket(argv[2])) < 0) { exit(1); } if ((connection = accept_unix_socket(listener)) >= 0) { real_sendfile(f, connection); } return 0; } EOF cat > client.c < #include #include #include #include "util.h" int main(int argc, char *argv[]) { int s; if (argc < 2) { fprintf(stderr, "Usage: %s socketname\n", argv[0]); exit(1); } if ((s = connect_unix_socket(argv[1])) < 0) { exit(1); } fake_sendfile(s, 1); return 0; } EOF cat > util.c < #include #include #include #include #include #include #include #include #include int create_unix_socket(void) { int fd; if ((fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) { perror("socket"); return -1; } return fd; } int make_unix_sockaddr(const char *pathname, struct sockaddr_un *sa) { memset(sa, 0, sizeof(*sa)); sa->sun_family = PF_LOCAL; if (strlen(pathname) + 1 > sizeof(sa->sun_path)) { // fprintf(stderr, "%s: pathname too long (max %lu)\n", // pathname, sizeof(sa->sun_path)); errno = ENAMETOOLONG; return -1; } strcpy(sa->sun_path, pathname); return 0; } static char *sockname; void delete_socket(void) { unlink(sockname); } int listen_unix_socket(const char *path) { int fd; struct sockaddr_un sa; if (make_unix_sockaddr(path, &sa) < 0) return -1; if ((fd = create_unix_socket()) < 0) return -1; if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0) { perror("bind"); close(fd); return -1; } sockname = strdup(path); atexit(delete_socket); if (listen(fd, 5) < 0) { perror("listen"); close(fd); return -1; } return fd; } int accept_unix_socket(int fd) { int s; if ((s = accept(fd, NULL, 0)) < 0) { perror("accept"); return -1; } return s; } int connect_unix_socket(const char *path) { int fd; struct sockaddr_un sa; if (make_unix_sockaddr(path, &sa) < 0) return -1; if ((fd = create_unix_socket()) < 0) return -1; if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0) { perror("connect"); return -1; } return fd; } #define BUFSIZE 65536 int fake_sendfile(int from, int to) { char buf[BUFSIZE]; int v; int sent = 0; while ((v = read(from, buf, BUFSIZE)) > 0) { int d = 0; while (d < v) { int w = write(to, buf, v - d); if (w <= 0) { perror("write"); return -1; } d += w; sent += w; } } if (v != 0) { perror("read"); return -1; } return sent; } int real_sendfile(int from, int to) { int v; v = sendfile(from, to, 0, 0, NULL, NULL, 0); if (v < 0) { perror("sendfile"); } return v; } EOF cat > util.h < #include #include #include #include #include #include int create_unix_socket(void); int make_unix_sockaddr(const char *pathname, struct sockaddr_un *sa); int listen_unix_socket(const char *path); int accept_unix_socket(int fd); int connect_unix_socket(const char *path); int fake_sendfile(int from, int to); int real_sendfile(int from, int to); EOF mycc -c -Wall -Wextra -O2 util.c mycc -o server -Wall -Wextra -O2 server.c util.o mycc -o client -Wall -Wextra -O2 client.c util.o rm -f server.c client.c util.c util.o util.h mysocket mount | grep "$mntpoint" | grep -q tmpfs && umount $mntpoint mount -t tmpfs tmpfs $mntpoint dd if=/dev/random of=$mntpoint/data bs=123456 count=1 > /dev/null 2>&1 ./server $mntpoint/data mysocket & sleep 0.2 ./client mysocket > data.$$ cmp $mntpoint/data data.$$ || { echo "FAIL Data mismatch"; ls -l $mntpoint/data data.$$; } rm -f data.$$ server client mysocket +wait while mount | grep "$mntpoint" | grep -q tmpfs; do umount $mntpoint || sleep 1 done Index: user/pho/stress2/misc/ucom.sh =================================================================== --- user/pho/stress2/misc/ucom.sh (revision 296724) +++ user/pho/stress2/misc/ucom.sh (revision 296725) @@ -1,71 +1,72 @@ #!/bin/sh # # Copyright (c) 2008 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$ # # Test disconnecting busy UCOM USB serial dongle [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg tst () { for i in `jot 10`; do [ -r /dev/cuaU0 ] && break sleep 1 done echo $1 (eval "$@")& sleep 10 ps | grep -qw $! && kill $! } if [ $# -eq 0 ]; then ( while true; do pstat -t > /dev/null sleep 1 done ) & pid=$! fi tst "cat < /dev/ttyU0" tst "cat < /dev/cuaU0" tst "cu -l /dev/cuaU0" tst "cu -l /dev/ttyU0" tst "stty -a -f /dev/ttyU0" tst "stty -a < /dev/ttyU0" tst "stty -f /dev/ttyU0 -a" tst "tail -F /dev/ttyU0" tst "tail /dev/ttyU0" [ ! -z "$pid" ] && kill $pid +wait Index: user/pho/stress2/misc/zfs6.sh =================================================================== --- user/pho/stress2/misc/zfs6.sh (revision 296724) +++ user/pho/stress2/misc/zfs6.sh (revision 296725) @@ -1,75 +1,76 @@ #!/bin/sh # # Copyright (c) 2009 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$ # # Parallel mount / umount and snapshots. No problems seen. [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 [ $((`sysctl -n hw.usermem` / 1024 / 1024 / 1024)) -le 3 ] && exit 0 . ../default.cfg kldstat -v | grep -q zfs.ko || { kldload zfs.ko; loaded=1; } u1=$mdstart u2=$((u1 + 1)) u3=$((u2 + 1)) mdconfig -l | grep -q md${u1} && mdconfig -d -u $u1 mdconfig -l | grep -q md${u2} && mdconfig -d -u $u2 mdconfig -l | grep -q md${u3} && mdconfig -d -u $u3 mdconfig -s 512m -u $u1 mdconfig -s 512m -u $u2 mdconfig -s 512m -u $u3 [ -d /tank ] && rm -rf /tank zpool create tank raidz md$u1 md$u2 md$u3 zfs create tank/test while true; do zfs umount tank/test zfs mount tank/test done & for i in `jot 5000`; do touch /tank/test/f$i zfs snapshot tank/test@$i if [ $i -gt 5 ]; then zfs destroy tank/test@$((i - 5)) fi done kill $! +wait zfs destroy -r tank zpool destroy tank mdconfig -d -u $u1 mdconfig -d -u $u2 mdconfig -d -u $u3 [ -n "$loaded" ] && kldunload zfs.ko