diff options
author | Alan Somers <asomers@FreeBSD.org> | 2019-10-07 20:21:23 +0000 |
---|---|---|
committer | Alan Somers <asomers@FreeBSD.org> | 2019-10-07 20:21:23 +0000 |
commit | c43f30ee6bec8b37e28c4bd814cd4869fd4f3167 (patch) | |
tree | ad63024671c4c3bb4f7a49091fc5806c14dbe3c2 /tests | |
parent | bbacbaccf9d6bab8a0d4907ec011b0a1209978b3 (diff) | |
download | src-c43f30ee6bec8b37e28c4bd814cd4869fd4f3167.tar.gz src-c43f30ee6bec8b37e28c4bd814cd4869fd4f3167.zip |
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
Notes
Notes:
svn path=/head/; revision=353289
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sys/cddl/zfs/include/libtest.kshlib | 11 | ||||
-rw-r--r-- | tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib | 4 | ||||
-rw-r--r-- | tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh | 1 |
3 files changed, 6 insertions, 10 deletions
diff --git a/tests/sys/cddl/zfs/include/libtest.kshlib b/tests/sys/cddl/zfs/include/libtest.kshlib index c1bbec0dc50a..389f6ac4cfa5 100644 --- a/tests/sys/cddl/zfs/include/libtest.kshlib +++ b/tests/sys/cddl/zfs/include/libtest.kshlib @@ -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] [dva_num] # 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; } diff --git a/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib b/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib index 4a1142d08d96..2fca88dc446a 100644 --- a/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib +++ b/tests/sys/cddl/zfs/tests/redundancy/redundancy.kshlib @@ -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" diff --git a/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh b/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh index 2e7e8b11f555..3f57c893174f 100644 --- a/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh +++ b/tests/sys/cddl/zfs/tests/redundancy/redundancy_001_pos.ksh @@ -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 |