From 4b0f5b2d7b99ca3ed9585173fe4b1c7fedda5aa5 Mon Sep 17 00:00:00 2001 From: Tim Chase Date: Sat, 7 Apr 2018 23:10:22 -0500 Subject: [PATCH] Wait for resilver after online This test performs a rapid offline/online cycle of each of several mirror vdevs. It can run so quickly that there isn't sufficient pool redundancy to perform an offline. The solution is to wait until the pool is resilvered following the online operation. Also, add a pool sync before the offline operation to help reduce spurious errors. Reviewed-by: Brian Behlendorf Signed-off-by: Tim Chase Issue #6900 --- .../cli_root/zpool_online/zpool_online_001_pos.ksh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_online/zpool_online_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_online/zpool_online_001_pos.ksh index 2fe6797760..7ba301e2b5 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_online/zpool_online_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_online/zpool_online_001_pos.ksh @@ -71,10 +71,13 @@ if [[ -z $DISKLIST ]]; then fi typeset -i i=0 +typeset -i j=0 for disk in $DISKLIST; do i=0 while [[ $i -lt ${#args[*]} ]]; do + + log_must sync_pool $TESTPOOL log_must zpool offline $TESTPOOL $disk check_state $TESTPOOL $disk "offline" if [[ $? != 0 ]]; then @@ -87,6 +90,14 @@ for disk in $DISKLIST; do log_fail "$disk of $TESTPOOL did not match online state" fi + while [[ $j -lt 20 ]]; do + is_pool_resilvered $TESTPOOL && break + sleep 0.5 + (( j = j + 1 )) + done + is_pool_resilvered $TESTPOOL || \ + log_file "Pool didn't resilver after online" + (( i = i + 1 )) done done