From owner-svn-src-projects@freebsd.org Wed Dec 16 00:17:22 2015 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4792FA48ECD for ; Wed, 16 Dec 2015 00:17:22 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC43C1DFD; Wed, 16 Dec 2015 00:17:21 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBG0HK68049605; Wed, 16 Dec 2015 00:17:20 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBG0HKHn049604; Wed, 16 Dec 2015 00:17:20 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201512160017.tBG0HKHn049604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 16 Dec 2015 00:17:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r292301 - projects/zfsd/head/tests/sys/cddl/zfs/tests/snapshot X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2015 00:17:22 -0000 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