Date: Wed, 16 Dec 2015 00:17:20 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r292301 - projects/zfsd/head/tests/sys/cddl/zfs/tests/snapshot Message-ID: <201512160017.tBG0HKHn049604@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Wed Dec 16 00:17:20 2015 New Revision: 292301 URL: https://svnweb.freebsd.org/changeset/base/292301 Log: tests/sys/cddl/zfs/tests/snapshot/snapshot_019_pos.ksh: - Significantly increase the aggressiveness of this test: - Before each stat call on $SNAPDIR, cd to $SNAPDIR. This tests the ability of the system to properly move process references. - Add a new "thread" that runs "ls $SNAPDIR/.." as fast as possible. This effectively forces the kernel to obtain the currently mounted snapshot filesystem's root vnode, mounting if necessary, and *then* use that vnode to lookup (and lock) its parent. - In addition to doing non-forced unmounts on $SNAPDIR, also do forced unmounts. - Finally, when the unmount loop ends, signal the "threads" to exit and wait for them to die. Then require a *non-forced* unmount of the filesystem, which tests for leaked references. Submitted by: Will Sponsored by: Spectra Logic Corp Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/snapshot/snapshot_019_pos.ksh Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/snapshot/snapshot_019_pos.ksh ============================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/snapshot/snapshot_019_pos.ksh Wed Dec 16 00:13:40 2015 (r292300) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/snapshot/snapshot_019_pos.ksh Wed Dec 16 00:17:20 2015 (r292301) @@ -57,11 +57,26 @@ verify_runnable "both" +KILL_SWITCH=${PWD}/kill_switch + function stat_snapshot { - #cd $TESTDIR/$SNAPROOT - while true; do - stat "$SNAPDIR" > /dev/null + while [ ! -f ${KILL_SWITCH} ]; do + cd $SNAPDIR # Exercise forced unmount + stat "$SNAPDIR" > /dev/null 2>&1 + done +} + +function ls_snapshot +{ + # Pre-generate the argument list. + ls_args="" + for ((num=0; $num<100; num=$num+1)); do + ls_args="$ls_args $SNAPDIR/.." + done + + while [ ! -f ${KILL_SWITCH} ]; do + ls $ls_args >/dev/null 2>&1 done } @@ -75,17 +90,28 @@ log_must $ZFS snapshot "$TESTPOOL/$TESTF # Repeatedly access the snapshot directory stat_snapshot & stat_pid="$!" +ls_snapshot & +ls_pid="$!" # Repeatedly unmount the snapshot directory for ((i=0; $i<100; i=$i+1)); do - umount "$SNAPDIR" - echo $i - # Sleep just long enough for stat() to have a chance at remounting. + umount "$SNAPDIR" >/dev/null 2>&1 + log_note "$i non-forced done" + # Sleep just long enough for the other "threads" to remount. + sleep 0.1 + umount -f "$SNAPDIR" >/dev/null 2>&1 + log_note "$i forced done" sleep 0.1 done -# Cleanup -log_must kill "$stat_pid" +# Kill the other "threads" and wait for them to die. +touch $KILL_SWITCH +log_note "Waiting for all child processes to die..." +wait + +# Test that no reference leaks occurred and we can cleanup without forcing. +log_must $ZFS unmount $TESTPOOL/$TESTFS +log_must $ZFS destroy -r $TESTPOOL/$TESTFS -# The only failure scenario is panic. If we got here, then we passed +# If we get here, we managed to not panic, deadlock, or leak references. log_pass
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512160017.tBG0HKHn049604>