diff --git a/usr/src/test/zfs-tests/tests/functional/features/async_destroy/async_destroy_001_pos.ksh b/usr/src/test/zfs-tests/tests/functional/features/async_destroy/async_destroy_001_pos.ksh index 7bcc56e0b564..ae1fb73c2c6d 100644 --- a/usr/src/test/zfs-tests/tests/functional/features/async_destroy/async_destroy_001_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/features/async_destroy/async_destroy_001_pos.ksh @@ -21,7 +21,7 @@ # # -# Copyright (c) 2013 by Delphix. All rights reserved. +# Copyright (c) 2013, 2014 by Delphix. All rights reserved. # . $STF_SUITE/include/libtest.shlib @@ -56,29 +56,32 @@ log_assert "async_destroy can suspend and resume traversal" log_must $ZFS create -o recordsize=512 -o compression=off $TEST_FS -# # Fill with 2G -# log_must $DD bs=1024k count=2048 if=/dev/zero of=/$TEST_FS/file log_must $ZFS destroy $TEST_FS +# +# We monitor the freeing property, to verify we can see blocks being +# freed while the suspend/resume code is exerciesd. +# +t0=$SECONDS count=0 -while [[ "0" != "$($ZPOOL list -Ho freeing $TESTPOOL)" ]]; do - count=$((count + 1)) - sleep 1 +while [[ $((SECONDS - t0)) -lt 10 ]]; do + [[ "0" != "$($ZPOOL list -Ho freeing $TESTPOOL)" ]] && ((count++)) + [[ $count -gt 1 ]] && break + $SLEEP 1 done -# -# We assert that the data took a few seconds to free to make sure that -# we actually exercised the suspend/resume code. The destroy should -# actually take much longer than this, so false positives are not likely. -# -log_must test $count -gt 5 +[[ $count -eq 0 ]] && log_fail "Freeing property remained empty" + +# Wait for everything to be freed. +while [[ "0" != "$($ZPOOL list -Ho freeing $TESTPOOL)" ]]; do + [[ $((SECONDS - t0)) -gt 180 ]] && \ + log_fail "Timed out waiting for freeing to drop to zero" +done -# # Check for leaked blocks. -# log_must $ZDB -b $TESTPOOL log_pass "async_destroy can suspend and resume traversal"