Author: asomers
Date: Mon Oct  7 20:21:23 2019
New Revision: 353289
URL: https://svnweb.freebsd.org/changeset/base/353289

Log:
  ZFS: fix the redundancy tests
  
  * Fix force_sync_path, which ensures that a file is fully flushed to disk.
    Apparently "zpool history"'s performance has improved, but exporting and
    importing the pool still works.
  * Fix file_dva by using undocumented zdb syntax to clarify that we're
    interested in the pool's root file system, not the pool itself. This
    should also fix the zpool_clear_001_pos test.
  * Remove a redundant cleanup step
  
  MFC after:    2 weeks
  Sponsored by: Axcient
  Differential Revision:        https://reviews.freebsd.org/D21901

Modified:
  head/tests/sys/cddl/zfs/include/libtest.kshlib
  head/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib
  head/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh

Modified: head/tests/sys/cddl/zfs/include/libtest.kshlib
==============================================================================
--- head/tests/sys/cddl/zfs/include/libtest.kshlib      Mon Oct  7 20:19:05 
2019        (r353288)
+++ head/tests/sys/cddl/zfs/include/libtest.kshlib      Mon Oct  7 20:21:23 
2019        (r353289)
@@ -2676,8 +2676,7 @@ 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
+# XXX 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.
@@ -2686,10 +2685,8 @@ 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
+       log_must $ZPOOL export $TESTPOOL
+       log_must $ZPOOL import -d $path $TESTPOOL
 }
 
 #
@@ -3326,7 +3323,7 @@ function file_dva # dataset filepath [level] [offset] 
        # The inner match is for 'DVA[0]=<0:1b412600:200>', in which the
        # text surrounding the actual DVA is a fixed size with 8 characters
        # before it and 1 after.
-       $ZDB -P -vvvvv $dataset $inode | \
+       $ZDB -P -vvvvv "$dataset/" $inode | \
            $AWK -v level=${level} -v dva_num=${dva_num} '
                BEGIN { stage = 0; }
                (stage == 0) && ($1=="Object") { stage = 1; next; }

Modified: head/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib
==============================================================================
--- head/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib  Mon Oct  7 
20:19:05 2019        (r353288)
+++ head/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib  Mon Oct  7 
20:21:23 2019        (r353289)
@@ -98,7 +98,7 @@ function setup_test_env
 
        typeset file=$TESTDIR/file
        log_must $FILE_WRITE -o create -f $file -b $BLOCKSZ -c $NUM_WRITES
-       log_must force_sync_path $TESTDIR
+       force_sync_path $BASEDIR
        record_data $TESTPOOL $PRE_RECORD_FILE
 }
 
@@ -142,7 +142,7 @@ function sync_pool #pool
 {
        typeset pool=$1
 
-       log_must force_sync_path $pool
+       force_sync_path $BASEDIR
 
        # If the OS has detected corruption on the pool, it will have
        # automatically initiated a scrub.  In that case, our "zpool scrub"

Modified: head/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh
==============================================================================
--- head/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh     Mon Oct 
 7 20:19:05 2019        (r353288)
+++ head/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh     Mon Oct 
 7 20:21:23 2019        (r353289)
@@ -62,7 +62,6 @@
 verify_runnable "global"
 
 log_assert "Verify raidz pool can withstand one device is failing."
-log_onexit cleanup
 
 for cnt in 3 2; do
        setup_test_env $TESTPOOL raidz $cnt
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to