diff options
author | George Melikov <[email protected]> | 2017-02-09 02:27:37 +0300 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-02-08 15:27:37 -0800 |
commit | d834b9ce5ba6be96ce13c31351cf92c89f7762fe (patch) | |
tree | 2f0281f8bdd55010801eae8904b043a6004074e1 /tests/zfs-tests/include | |
parent | d32d25c5c26c8d1e254bc0fcb8a8ae059e95cebc (diff) |
Add `wait_freeing` helper function to ZTS
Sometimes the ZTS checks freed space just after `zfs destroy snapshot` and
gets an unexpected value because of space being freed asynchronously.
For cases like this add a `wait_freeing` function which blocks until the
pools `freeing` property drops to zero.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: George Melikov <[email protected]>
Closes #5740
Diffstat (limited to 'tests/zfs-tests/include')
-rw-r--r-- | tests/zfs-tests/include/libtest.shlib | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index 4127d35a8..31b1e1dfc 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -3078,3 +3078,17 @@ function sync_pool #pool log_must $SLEEP 2 done } + +# +# Wait for zpool 'freeing' property drops to zero. +# +# $1 pool name +# +function wait_freeing #pool +{ + typeset pool=${1:-$TESTPOOL} + while true; do + [[ "0" == "$($ZPOOL list -Ho freeing $pool)" ]] && break + log_must $SLEEP 1 + done +} |