]> git.proxmox.com Git - mirror_zfs.git/commitdiff
ZTS: Fix removal_resume_export
authorLOLi <loli10K@users.noreply.github.com>
Mon, 24 Sep 2018 19:58:16 +0000 (21:58 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 24 Sep 2018 19:58:16 +0000 (12:58 -0700)
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 <mahrens@delphix.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #7894
Closes #7913

tests/test-runner/bin/zts-report.py
tests/zfs-tests/tests/functional/removal/removal_resume_export.ksh

index 6f4c97e5352235c2ebfcbb92642aae2562193636..2cf2eb9412ca5e454c344371a5c9ec8257228db7 100755 (executable)
@@ -256,7 +256,6 @@ maybe = {
     'no_space/enospc_002_pos': ['FAIL', enospc_reason],
     'projectquota/setup': ['SKIP', exec_reason],
     'redundancy/redundancy_004_neg': ['FAIL', '7290'],
-    'removal/removal_resume_export': ['FAIL', '7894'],
     'reservation/reservation_008_pos': ['FAIL', '7741'],
     'reservation/reservation_018_pos': ['FAIL', '5642'],
     'rsend/rsend_019_pos': ['FAIL', '6086'],
index 2c69c591af84846b15d311b09a1c388cac95899b..4f1e63cd06b648c660a2c6f87b11bcfca1bab5bd 100755 (executable)
@@ -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
 }
 
@@ -86,12 +60,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.
@@ -109,26 +77,15 @@ 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"