Use log_must_busy in destroy_pool

The log function log_must_busy was added in commit e623aea2 for
this purpose.  Update destroy_pool to use it.

Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #6217
This commit is contained in:
Brian Behlendorf 2017-06-12 09:45:32 -07:00 committed by GitHub
parent 88c30122e5
commit 851aa99c89

View File

@ -1496,20 +1496,11 @@ function destroy_pool #pool
if poolexists "$pool" ; then
mtpt=$(get_prop mountpoint "$pool")
# At times, syseventd activity can cause attempts to
# destroy a pool to fail with EBUSY. We retry a few
# At times, syseventd/udev activity can cause attempts
# to destroy a pool to fail with EBUSY. We retry a few
# times allowing failures before requiring the destroy
# to succeed.
typeset -i wait_time=10 ret=1 count=0
must=""
while [[ $ret -ne 0 ]]; do
$must zpool destroy -f $pool
ret=$?
[[ $ret -eq 0 ]] && break
log_note "zpool destroy failed with $ret"
[[ count++ -ge 7 ]] && must=log_must
sleep $wait_time
done
log_must_busy zpool destroy -f $pool
[[ -d $mtpt ]] && \
log_must rm -rf $mtpt