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 <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Issue #6900
This commit is contained in:
Tim Chase 2018-04-07 23:10:22 -05:00 committed by Brian Behlendorf
parent 5c596ba7a4
commit 4b0f5b2d7b
1 changed files with 11 additions and 0 deletions

View File

@ -71,10 +71,13 @@ if [[ -z $DISKLIST ]]; then
fi fi
typeset -i i=0 typeset -i i=0
typeset -i j=0
for disk in $DISKLIST; do for disk in $DISKLIST; do
i=0 i=0
while [[ $i -lt ${#args[*]} ]]; do while [[ $i -lt ${#args[*]} ]]; do
log_must sync_pool $TESTPOOL
log_must zpool offline $TESTPOOL $disk log_must zpool offline $TESTPOOL $disk
check_state $TESTPOOL $disk "offline" check_state $TESTPOOL $disk "offline"
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
@ -87,6 +90,14 @@ for disk in $DISKLIST; do
log_fail "$disk of $TESTPOOL did not match online state" log_fail "$disk of $TESTPOOL did not match online state"
fi 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 )) (( i = i + 1 ))
done done
done done