aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests
diff options
context:
space:
mode:
authorLOLi <[email protected]>2018-09-24 21:58:16 +0200
committerBrian Behlendorf <[email protected]>2018-09-24 12:58:16 -0700
commit36e369ecb847570d6939073663c4e95406223c7f (patch)
treeda4961223fae5c75c7b66265caef6655f1514bb4 /tests/zfs-tests
parentb8fd4310c54444eecb66140d99a6156f4353b29b (diff)
ZTS: Fix removal_resume_export
This change simplify the test case removing part of the logic which was introducing a race condition and thus causing spurious failures: we use attempt_during_removal() from removal.kshlib instead which has been observed to be more stable. Reviewed by: Matthew Ahrens <[email protected]> Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #7894 Closes #7913
Diffstat (limited to 'tests/zfs-tests')
-rwxr-xr-xtests/zfs-tests/tests/functional/removal/removal_resume_export.ksh51
1 files changed, 4 insertions, 47 deletions
diff --git a/tests/zfs-tests/tests/functional/removal/removal_resume_export.ksh b/tests/zfs-tests/tests/functional/removal/removal_resume_export.ksh
index 2c69c591a..4f1e63cd0 100755
--- a/tests/zfs-tests/tests/functional/removal/removal_resume_export.ksh
+++ b/tests/zfs-tests/tests/functional/removal/removal_resume_export.ksh
@@ -37,8 +37,7 @@
# 3. Inject a fault in the pool and attempt to export (it
# should fail).
# 4. After the export fails ensure that the removal thread
-# was restarted (i.e. the svr_thread field in the spa
-# should be non-zero).
+# was restarted and the process complete successfully.
#
@@ -48,34 +47,9 @@ function cleanup
default_cleanup_noexit
}
-function ensure_thread_running # spa_address
+function callback
{
- if is_linux; then
- typeset TRIES=0
- typeset THREAD_PID
- while [[ $TRIES -lt 50 ]]; do
- THREAD_PID=$(pgrep spa_vdev_remove)
- [[ "$THREAD_PID" ]] && break
- sleep 0.1
- (( TRIES = TRIES + 1 ))
- done
- [[ "$THREAD_PID" ]] || \
- log_fail "removal thread is not running TRIES=$TRIES THREAD_PID=$THREAD_PID"
- else
- #
- # Try to get the address of the removal thread.
- #
- typeset THREAD_ADDR=$(mdb -ke "$1::print \
- spa_t spa_vdev_removal->svr_thread" | awk "{print \$3}")
-
- #
- # if address is NULL it means that the thread is
- # not running.
- #
- [[ "$THREAD_ADDR" = 0 ]] && \
- log_fail "removal thread is not running"
- fi
-
+ log_mustnot zpool export $TESTPOOL
return 0
}
@@ -87,12 +61,6 @@ log_onexit cleanup
log_must default_setup_noexit "$REMOVEDISK"
#
-# Save address of SPA in memory so you can check with mdb
-# if the removal thread is running.
-#
-is_linux || typeset SPA_ADDR=$(mdb -ke "::spa" | awk "/$TESTPOOL/ {print \$1}")
-
-#
# Turn off compression to raise capacity as much as possible
# for the little time that this test runs.
#
@@ -110,25 +78,14 @@ log_must dd if=/dev/urandom of=$TESTDIR/$TESTFILE0 bs=64M count=32
log_must zpool add -f $TESTPOOL $NOTREMOVEDISK
#
-# Start removal.
-#
-log_must zpool remove $TESTPOOL $REMOVEDISK
-
-#
# Inject an error so export fails after having just suspended
# the removal thread. [spa_inject_ref gets incremented]
#
log_must zinject -d $REMOVEDISK -D 10:1 $TESTPOOL
-log_must ensure_thread_running $SPA_ADDR
-
#
# Because of the above error export should fail.
#
-log_mustnot zpool export $TESTPOOL
-
-log_must ensure_thread_running $SPA_ADDR
-
-wait_for_removal $TESTPOOL
+log_must attempt_during_removal $TESTPOOL $REMOVEDISK callback
log_pass "Device removal thread resumes after failed export"