mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-04-06 17:49:11 +03:00
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 <behlendorf1@llnl.gov> Signed-off-by: George Melikov <mail@gmelikov.ru> Closes #5740
This commit is contained in:
parent
d32d25c5c2
commit
d834b9ce5b
@ -3078,3 +3078,17 @@ function sync_pool #pool
|
|||||||
log_must $SLEEP 2
|
log_must $SLEEP 2
|
||||||
done
|
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
|
||||||
|
}
|
||||||
|
@ -92,6 +92,8 @@ function set_n_check_prop
|
|||||||
log_mustnot $ZFS set $prop=$expect_value $dataset
|
log_mustnot $ZFS set $prop=$expect_value $dataset
|
||||||
|
|
||||||
[[ -n $prop ]] && cur_value=$(get_prop $prop $dataset)
|
[[ -n $prop ]] && cur_value=$(get_prop $prop $dataset)
|
||||||
|
|
||||||
|
wait_freeing
|
||||||
|
|
||||||
if [[ "$expect_value" != "" && "$cur_value" != "$old_value" ]];
|
if [[ "$expect_value" != "" && "$cur_value" != "$old_value" ]];
|
||||||
then
|
then
|
||||||
|
@ -88,6 +88,8 @@ while [[ $i -lt $COUNT ]]; do
|
|||||||
(( i = i + 1 ))
|
(( i = i + 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
wait_freeing $TESTPOOL
|
||||||
|
|
||||||
new_size=`get_prop available $TESTPOOL`
|
new_size=`get_prop available $TESTPOOL`
|
||||||
|
|
||||||
typeset -i tolerance=0
|
typeset -i tolerance=0
|
||||||
|
Loading…
Reference in New Issue
Block a user