]> git.proxmox.com Git - mirror_zfs.git/commitdiff
ZTS: Improve zpool_scrub_004_pos reliability
authorBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 15 May 2018 15:58:46 +0000 (08:58 -0700)
committerGitHub <noreply@github.com>
Tue, 15 May 2018 15:58:46 +0000 (08:58 -0700)
It's possible for the `zpool attach` portion of this test case
to complete before the `zpool scrub` can be issued.  Update the
test case to force the resilvering phase to take longer.

Reviewed-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #5444
Closes #7541

tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_004_pos.ksh

index 4d29e78bcbfbf688007714122d92f411d1cb9c6f..14563d64d149274f68b7cc1d668639fd0dcaa4ea 100755 (executable)
@@ -39,7 +39,9 @@
 # STRATEGY:
 #      1. Setup a mirror pool and filled with data.
 #      2. Detach one of devices
-#      3. Verify scrub failed until the resilver completed
+#      3. Create a file for the resilver to work on so it takes some time
+#      4. Export/import the pool to ensure the cache is dropped
+#      5. Verify scrub failed until the resilver completed
 #
 # NOTES:
 #      Artificially limit the scrub speed by setting the zfs_scan_vdev_limit
 function cleanup
 {
        log_must set_tunable64 zfs_scan_vdev_limit $ZFS_SCAN_VDEV_LIMIT_DEFAULT
+       rm -f $mntpnt/extra
 }
 
 verify_runnable "global"
 
-# See issue: https://github.com/zfsonlinux/zfs/issues/5444
-if is_32bit; then
-       log_unsupported "Test case fails on 32-bit systems"
-fi
-
 log_onexit cleanup
 
 log_assert "Resilver prevent scrub from starting until the resilver completes"
 
+mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS)
 log_must set_tunable64 zfs_scan_vdev_limit $ZFS_SCAN_VDEV_LIMIT_SLOW
-log_must zpool detach $TESTPOOL $DISK2
-log_must zpool attach $TESTPOOL $DISK1 $DISK2
+
+while ! is_pool_resilvering $TESTPOOL; do
+       log_must zpool detach $TESTPOOL $DISK2
+       log_must file_write -b 1048576 -c 128 -o create -d 0 -f $mntpnt/extra
+       log_must zpool export $TESTPOOL
+       log_must zpool import $TESTPOOL
+       log_must zpool attach $TESTPOOL $DISK1 $DISK2
+done
+
 log_must is_pool_resilvering $TESTPOOL
 log_mustnot zpool scrub $TESTPOOL