svn commit: r292369 - in projects/zfsd/head/tests/sys/cddl/zfs: include tests/redundancy
Alan Somers
asomers at FreeBSD.org
Wed Dec 16 21:05:46 UTC 2015
Author: asomers
Date: Wed Dec 16 21:05:44 2015
New Revision: 292369
URL: https://svnweb.freebsd.org/changeset/base/292369
Log:
Add a function that syncs to stable storage, not just the ZIL.
Use it to try to stamp out intermittent failures in the ZFS test suite's
redundancy tests.
tests/sys/cddl/zfs/include/libtest.kshlib:
- Add force_sync_path(), which (ab)uses the fact that 'zpool
history' always does a txg_wait_synced() for its first ioctl call.
sync(8) doesn't have the flexibility to handle this type of call,
and there isn't a better option available that does not mutate the
pool.
- Leave a XXX comment to flag this implementation as a hack.
- Some history: Previously, I had changed zfs_sync(), ZFS's
VFS_SYNC(9), so that it would call txg_wait_synced(), as a
workaround for a performance drop off issue. gibbs later fixed
this by changing zfs_sync() to ignore syncer(4)'s periodic
requests to sync to stable storage, and reverted the
txg_wait_synced() call back to zil_commit().
tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib:
- Use foce_sync_path instead of $SYNC for the redundancy test suite,
which relies on the data actually getting written to the target
devices so they can be corrupted directly. These may not be the
only place this would be useful, but this is somewhat of an
experiment to determine whether the intermittent failures stop.
Submitted by: Will
Sponsored by: Spectra Logic Corp
Modified:
projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib
projects/zfsd/head/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib
Modified: projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib Wed Dec 16 21:03:52 2015 (r292368)
+++ projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib Wed Dec 16 21:05:44 2015 (r292369)
@@ -2696,6 +2696,25 @@ function gen_dataset_name
}
#
+# Ensure that a given path has been synced, not just ZIL committed.
+#
+# XXX The implementation currently requires calling 'zpool history'. On
+# FreeBSD, the sync(8) command (via $SYNC) calls zfs_sync() which just
+# does a zil_commit(), as opposed to a txg_wait_synced(). For things that
+# require writing to their final destination (e.g. for intentional
+# corruption purposes), zil_commit() is not good enough.
+#
+function force_sync_path # path
+{
+ typeset path="$1"
+
+ zfspath=$($DF $path 2>/dev/null | tail -1 | cut -d" " -f1 | cut -d/ -f1)
+ [ -z "$zfspath" ] && return false
+ log_note "Force syncing ${zfspath} for ${path} ..."
+ $ZPOOL history $zfspath >/dev/null 2>&1
+}
+
+#
# Get cksum tuple of dataset
# $1 dataset name
#
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib Wed Dec 16 21:03:52 2015 (r292368)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib Wed Dec 16 21:05:44 2015 (r292369)
@@ -95,7 +95,7 @@ function setup_test_env
typeset file=$TESTDIR/file
log_must $FILE_WRITE -o create -f $file -b $BLOCKSZ -c $NUM_WRITES
- log_must $SYNC $TESTDIR
+ log_must force_sync_path $TESTDIR
record_data $TESTPOOL $PRE_RECORD_FILE
}
@@ -139,8 +139,7 @@ function sync_pool #pool
{
typeset pool=$1
- log_must $SYNC
- log_must $SLEEP 2
+ log_must force_sync_path $pool
# If the OS has detected corruption on the pool, it will have
# automatically initiated a scrub. In that case, our "zpool scrub"
More information about the svn-src-projects
mailing list