ZTS: Improve zpool_scrub_004_pos reliability

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
This commit is contained in:
Brian Behlendorf 2018-05-15 08:58:46 -07:00 committed by GitHub
parent 8c64fe0442
commit ab6a2b5cd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 8 deletions

View File

@ -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
@ -49,22 +51,26 @@
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