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:
Giuseppe Di Natale
2018-03-06 14:54:57 -08:00
committed by Brian Behlendorf
parent 2705ebf0a7
commit c7b55e71b0
4 changed files with 47 additions and 24 deletions
@@ -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