mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-31 03:04:11 +03:00
Introduce a destroy_dataset helper
Datasets can be busy when calling zfs destroy. Introduce a helper function to destroy datasets and use it to destroy datasets in zfs_allow_004_pos, zfs_promote_008_pos, and zfs_destroy_002_pos. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov> Closes #7224 Closes #7246 Closes #7249 Closes #7267
This commit is contained in:
committed by
Brian Behlendorf
parent
2705ebf0a7
commit
c7b55e71b0
@@ -49,8 +49,7 @@ function cleanup
|
||||
{
|
||||
typeset -i i=0
|
||||
while (( $i < ${#data_objs[*]} )); do
|
||||
datasetexists "${data_objs[i]}" && \
|
||||
zfs destroy -rf ${data_objs[i]}
|
||||
destroy_dataset "${data_objs[i]}" "-rf"
|
||||
((i = i + 1))
|
||||
done
|
||||
}
|
||||
@@ -87,7 +86,7 @@ done
|
||||
|
||||
i=0
|
||||
while (( $i < ${#data_objs[*]} )); do
|
||||
log_must zfs destroy ${data_objs[i]}
|
||||
destroy_dataset "${data_objs[i]}"
|
||||
datasetexists ${data_objs[i]} && \
|
||||
log_fail "'zfs destroy <filesystem>|<volume>|<snapshot>' fail."
|
||||
((i = i + 1))
|
||||
|
||||
@@ -49,7 +49,7 @@ function cleanup
|
||||
log_must zfs promote $vol
|
||||
fi
|
||||
|
||||
log_must zfs destroy -rR $snap
|
||||
destroy_dataset "$snap" "-rR"
|
||||
}
|
||||
|
||||
log_assert "'zfs promote' can promote a volume clone."
|
||||
|
||||
@@ -53,15 +53,11 @@ function cleanup_user_group
|
||||
#
|
||||
function restore_root_datasets
|
||||
{
|
||||
if datasetexists $ROOT_TESTFS ; then
|
||||
log_must zfs destroy -Rf $ROOT_TESTFS
|
||||
fi
|
||||
destroy_dataset "$ROOT_TESTFS" "-Rf"
|
||||
log_must zfs create $ROOT_TESTFS
|
||||
|
||||
if is_global_zone ; then
|
||||
if datasetexists $ROOT_TESTVOL ; then
|
||||
log_must zfs destroy -Rf $ROOT_TESTVOL
|
||||
fi
|
||||
destroy_dataset "$ROOT_TESTVOL" "-Rf"
|
||||
log_must zfs create -V $VOLSIZE $ROOT_TESTVOL
|
||||
block_device_wait
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user