ZTS: Standardize use of destroy_dataset in cleanup

When cleaning up a test case standardize on using the convention:

    datasetexists $ds && destroy_dataset $ds <flags>

By using 'destroy_dataset' instead of 'log_must zfs destroy' we ensure
that the destroy is retried in the event that a ZFS volume is busy.
This helps ensures ensure tests are fully cleaned up and prevents false
positive test failures on Linux.

Note that all of the tests which used 'zfs destroy' in cleanup have
been updated even if they don't use volumes.  This was done to
clearly establish the expected convention.

Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #12663
This commit is contained in:
Brian Behlendorf 2021-10-25 14:13:50 -07:00 committed by Tony Hutter
parent 55ab3773d7
commit af9aa4a216
242 changed files with 422 additions and 654 deletions

View File

@ -51,14 +51,9 @@
verify_runnable "global"
function cleanup {
if datasetexists $TESTPOOL/vol
then
log_must zfs destroy $TESTPOOL/vol
fi
if poolexists $TESTPOOL
then
log_must zpool destroy $TESTPOOL
fi
datasetexists $TESTPOOL/vol && destroy_dataset $TESTPOOL/vol
poolexists $TESTPOOL && log_must zpool destroy $TESTPOOL
if [[ -f $VDEV ]]; then
log_must rm -f $VDEV
fi

View File

@ -34,7 +34,7 @@ function create_testfs
function destroy_testfs
{
if datasetexists $TESTPOOL/$TESTFS ; then
log_must zfs destroy -f $TESTPOOL/$TESTFS
destroy_dataset $TESTPOOL/$TESTFS -f
rm -rf $TESTDIR || log_unresolved Could not remove $TESTDIR
fi
}

View File

@ -30,7 +30,7 @@ create_clone
function cleanup
{
datasetexists $TESTPOOL/$TESTFS@$TESTSNAP && \
log_must zfs destroy -R $TESTPOOL/$TESTFS@$TESTSNAP
destroy_dataset $TESTPOOL/$TESTFS@$TESTSNAP -R
}
log_must_program $TESTPOOL $ZCP_ROOT/lua_core/tst.exists.zcp \

View File

@ -27,7 +27,7 @@ fs=$TESTPOOL/$TESTFS/testchild
function cleanup
{
datasetexists $fs && log_must zfs destroy -R $fs
datasetexists $fs && destroy_dataset $fs -R
}
log_onexit cleanup

View File

@ -30,8 +30,8 @@ clone=$TESTPOOL/$TESTCLONE
function cleanup
{
datasetexists $clone && log_must zfs destroy $clone
datasetexists $fs && log_must zfs destroy -R $fs
datasetexists $clone && destroy_dataset $clone
datasetexists $fs && destroy_dataset $fs -R
}
log_onexit cleanup

View File

@ -28,7 +28,7 @@ limit=50000000
function cleanup
{
datasetexists $rootfs && log_must zfs destroy -R $rootfs
datasetexists $rootfs && destroy_dataset $rootfs -R
}
log_onexit cleanup

View File

@ -56,9 +56,7 @@ function cleanup
rm -rf $corepath
fi
for ds in $fs1 $fs $ctr; do
if datasetexists $ds; then
log_must zfs destroy -rRf $ds
fi
datasetexists $ds && destroy_dataset $ds -rRf
done
}

View File

@ -54,15 +54,14 @@ verify_runnable "both"
function cleanup
{
if snapexists "$DATASET@$TESTSNAP"; then
log_must zfs destroy "$DATASET@$TESTSNAP"
fi
if bkmarkexists "$DATASET#$TESTBM"; then
log_must zfs destroy "$DATASET#$TESTBM"
fi
if bkmarkexists "$DATASET#$TESTBMCOPY"; then
log_must zfs destroy "$DATASET#$TESTBMCOPY"
fi
snapexists "$DATASET@$TESTSNAP" && \
destroy_dataset "$DATASET@$TESTSNAP"
bkmarkexists "$DATASET#$TESTBM" && \
destroy_dataset "$DATASET#$TESTBM"
bkmarkexists "$DATASET#$TESTBMCOPY" && \
destroy_dataset "$DATASET#$TESTBMCOPY"
}
log_assert "'zfs bookmark' should work only when passed valid arguments."

View File

@ -40,7 +40,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -f $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -f
}
log_onexit cleanup

View File

@ -44,7 +44,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -r
}
log_onexit cleanup

View File

@ -40,7 +40,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -Rf $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -Rf
}
log_onexit cleanup

View File

@ -43,7 +43,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -f $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -f
}
log_onexit cleanup

View File

@ -42,7 +42,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -r
}
log_onexit cleanup

View File

@ -38,7 +38,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -f $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -f
}
log_onexit cleanup

View File

@ -40,7 +40,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -f $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -f
}
log_onexit cleanup

View File

@ -52,7 +52,7 @@ function verify_pbkdf2iters
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -f $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -f
}
log_onexit cleanup

View File

@ -100,11 +100,11 @@ function setup_all
function cleanup_all
{
for fs in $targets; do
datasetexists $fs && log_must zfs destroy -f $fs
datasetexists $fs && destroy_dataset $fs -f
done
for snap in $SNAPFS $SNAPFS1 ; do
snapexists $snap && log_must zfs destroy -Rf $snap
snapexists $snap && destroy_dataset $snap -Rf
done
return 0

View File

@ -60,14 +60,10 @@ function setup_all
function cleanup_all
{
if datasetexists $TESTPOOL/notexist ; then
log_must zfs destroy -rRf $TESTPOOL/notexist
fi
datasetexists $TESTPOOL/notexist && destroy_dataset $TESTPOOL/notexist -rRf
for snap in $SNAPFS $SNAPFS1 ; do
if snapexists $snap ; then
log_must zfs destroy -Rf $snap
fi
snapexists $snap && destroy_dataset $snap -Rf
done
return 0

View File

@ -48,9 +48,7 @@ verify_runnable "both"
function cleanup
{
if snapexists $SNAPFS ; then
log_must zfs destroy -Rf $SNAPFS
fi
snapexists $SNAPFS && destroy_dataset $SNAPFS -Rf
}
log_onexit cleanup

View File

@ -48,9 +48,7 @@ verify_runnable "both"
function cleanup
{
if snapexists $SNAPFS ; then
log_must zfs destroy -Rf $SNAPFS
fi
snapexists $SNAPFS && destroy_dataset $SNAPFS -Rf
}
log_onexit cleanup

View File

@ -48,9 +48,7 @@ verify_runnable "global"
function cleanup
{
if snapexists $SNAPFS1 ; then
log_must zfs destroy -Rf $SNAPFS1
fi
snapexists $SNAPFS1 && destroy_dataset $SNAPFS1 -Rf
}
log_onexit cleanup

View File

@ -49,9 +49,7 @@ verify_runnable "global"
function cleanup
{
if snapexists $SNAPFS1 ; then
log_must_busy zfs destroy -Rf $SNAPFS1
fi
snapexists $SNAPFS1 && destroy_dataset $SNAPFS1 -Rf
}
log_onexit cleanup

View File

@ -47,9 +47,7 @@ verify_runnable "both"
function cleanup
{
if snapexists $SNAPFS ; then
log_must zfs destroy -Rf $SNAPFS
fi
snapexists $SNAPFS && destroy_dataset $SNAPFS -Rf
}
log_onexit cleanup

View File

@ -48,9 +48,7 @@ verify_runnable "both"
function cleanup
{
if snapexists $SNAPFS ; then
log_must zfs destroy -Rf $SNAPFS
fi
snapexists $SNAPFS && destroy_dataset $SNAPFS -Rf
}
log_onexit cleanup

View File

@ -48,9 +48,7 @@ verify_runnable "global"
function cleanup
{
if snapexists $SNAPFS1 ; then
log_must zfs destroy -Rf $SNAPFS1
fi
snapexists $SNAPFS1 && destroy_dataset $SNAPFS1 -Rf
}
log_onexit cleanup

View File

@ -39,8 +39,8 @@ function local_cleanup
typeset -i i=1
for ds in $datasets; do
datasetexists $ds/$TESTCLONE.$i && \
log_must zfs destroy -rf $ds/$TESTCLONE.$i
datasetexists $ds && log_must zfs destroy -Rf $ds
destroy_dataset $ds/$TESTCLONE.$i -rf
datasetexists $ds && destroy_dataset $ds -Rf
((i=i+1))
done
}

View File

@ -44,9 +44,9 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS2 && \
log_must zfs destroy -f $TESTPOOL/$TESTFS2
destroy_dataset $TESTPOOL/$TESTFS2 -f
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -r
}
log_onexit cleanup

View File

@ -49,9 +49,7 @@ function cleanup
typeset ds
for ds in $fs1 $fs2 $vol1 $vol2; do
if datasetexists $ds; then
log_must zfs destroy $ds
fi
datasetexists $ds && destroy_dataset $ds
done
}
@ -94,13 +92,13 @@ for val in 1 2 3; do
fi
for ds in $fs2 $vol2; do
cmp_prop $ds $val2
log_must zfs destroy $ds
destroy_dataset $ds
block_device_wait
done
done
for ds in $fs1 $vol1; do
log_must zfs destroy $ds
destroy_dataset $ds
block_device_wait
done

View File

@ -50,9 +50,8 @@ function cleanup
typeset val
for val in 1 2 3; do
if datasetexists $TESTPOOL/fs_$val; then
log_must zfs destroy $TESTPOOL/fs_$val
fi
datasetexists $TESTPOOL/fs_$val && \
destroy_dataset $TESTPOOL/fs_$val
done
}

View File

@ -51,9 +51,7 @@ function cleanup
destroy_pool $TESTPOOL1
fi
if datasetexists $vol; then
log_must zfs destroy $vol
fi
datasetexists $vol && destroy_dataset $vol
}
log_assert "Verify that ZFS volume space used by multiple copies is charged correctly."

View File

@ -51,9 +51,7 @@ function cleanup
log_must umount $mntp
fi
if datasetexists $vol; then
log_must zfs destroy $vol
fi
datasetexists $vol && destroy_dataset $vol
if [[ -d $mntp ]]; then
rm -rf $mntp

View File

@ -48,7 +48,7 @@ function cleanup
typeset -i i=0
while (( $i < ${#datasets[*]} )); do
datasetexists ${datasets[$i]} && \
log_must zfs destroy -f ${datasets[$i]}
destroy_dataset ${datasets[$i]} -f
((i = i + 1))
done

View File

@ -46,8 +46,7 @@ verify_runnable "global"
function cleanup
{
datasetexists $vol && \
log_must zfs destroy -f $vol
datasetexists $vol && destroy_dataset $vol -f
}
log_assert "Verify creating volume with specified blocksize works."

View File

@ -48,8 +48,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -f $TESTPOOL/$TESTFS1
datasetexists $TESTPOOL/$TESTFS1 && destroy_dataset $TESTPOOL/$TESTFS1 -f
}
log_onexit cleanup
@ -65,7 +64,7 @@ while (( $i < ${#RW_FS_PROP[*]} )); do
log_fail "zfs create $TESTPOOL/$TESTFS1 fail."
propertycheck $TESTPOOL/$TESTFS1 ${RW_FS_PROP[i]} || \
log_fail "${RW_FS_PROP[i]} is failed to set."
log_must zfs destroy -f $TESTPOOL/$TESTFS1
log_must_busy zfs destroy -f $TESTPOOL/$TESTFS1
(( i = i + 1 ))
done

View File

@ -49,7 +49,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -f $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -f
}
log_onexit cleanup

View File

@ -50,7 +50,7 @@ verify_runnable "global"
function cleanup
{
datasetexists $TESTPOOL/$TESTVOL1 && \
log_must zfs destroy -f $TESTPOOL/$TESTVOL1
destroy_dataset $TESTPOOL/$TESTVOL1 -f
}
log_onexit cleanup

View File

@ -46,9 +46,8 @@ verify_runnable "both"
function cleanup
{
if datasetexists $TESTPOOL/$TESTFS1 ; then
log_must zfs destroy -f $TESTPOOL/$TESTFS1
fi
datasetexists $TESTPOOL/$TESTFS1 && \
destroy_dataset $TESTPOOL/$TESTFS1 -f
}
log_onexit cleanup

View File

@ -48,9 +48,8 @@ verify_runnable "both"
function cleanup
{
if datasetexists $TESTPOOL/$TESTFS1 ; then
log_must zfs destroy -rf $TESTPOOL/$TESTFS1
fi
datasetexists $TESTPOOL/$TESTFS1 && \
destroy_dataset $TESTPOOL/$TESTFS1 -rf
}
log_onexit cleanup

View File

@ -48,9 +48,8 @@ verify_runnable "both"
function cleanup
{
if datasetexists $TESTPOOL/$TESTFS1 ; then
log_must zfs destroy -rf $TESTPOOL/$TESTFS1
fi
datasetexists $TESTPOOL/$TESTFS1 && \
destroy_dataset $TESTPOOL/$TESTFS1 -rf
}
log_onexit cleanup

View File

@ -43,8 +43,7 @@ TESTFS2=$(for i in $(seq $((255 - ${#TESTPOOL}))); do echo z ; done | tr -d '\n'
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 &&
log_must zfs destroy $TESTPOOL/$TESTFS1
datasetexists $TESTPOOL/$TESTFS1 && destroy_dataset $TESTPOOL/$TESTFS1
}
log_onexit cleanup

View File

@ -38,7 +38,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -f $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -f
}
log_onexit cleanup
@ -89,7 +89,7 @@ while (( i < ${#ENCRYPTION_ALGS[*]} )); do
propertycheck $TESTPOOL/$TESTFS1 ${KEYFORMATS[j]} || \
log_fail "failed to set ${KEYFORMATS[j]}"
log_must zfs destroy -f $TESTPOOL/$TESTFS1
log_must_busy zfs destroy -f $TESTPOOL/$TESTFS1
(( j = j + 1 ))
done
(( i = i + 1 ))

View File

@ -126,9 +126,8 @@ function dry_create_parseable
function cleanup
{
if datasetexists "$TESTPOOL/$TESTFS1"; then
log_must zfs destroy -r "$TESTPOOL/$TESTFS1"
fi
datasetexists "$TESTPOOL/$TESTFS1" && \
destroy_dataset "$TESTPOOL/$TESTFS1" -r
}
log_onexit cleanup

View File

@ -70,9 +70,9 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -r
datasetexists $TESTPOOL/$TESTFS2 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS2
destroy_dataset $TESTPOOL/$TESTFS2 -r
}
log_onexit cleanup

View File

@ -131,9 +131,8 @@ function dry_create_parseable
function cleanup
{
if datasetexists "$TESTPOOL/$TESTFS1"; then
log_must_busy zfs destroy -r "$TESTPOOL/$TESTFS1"
fi
datasetexists "$TESTPOOL/$TESTFS1" && \
destroy_dataset "$TESTPOOL/$TESTFS1" -r
}
log_onexit cleanup

View File

@ -77,9 +77,7 @@ function test_n_check
fi
# Clean the test environment and make it clear.
if datasetexists $CTR; then
log_must zfs destroy -Rf $CTR
fi
datasetexists $CTR && destroy_dataset $CTR -Rf
# According to option create test compatible environment.
case $opt in

View File

@ -50,8 +50,7 @@ verify_runnable "both"
function cleanup
{
for obj in $ctr2 $ctr1 $ctr; do
datasetexists $obj && \
log_must zfs destroy -Rf $obj
datasetexists $obj && destroy_dataset $obj -Rf
done
for mntp in $TESTDIR1 $TESTDIR2; do
@ -142,14 +141,14 @@ done
log_note "Verify that 'zfs destroy -R' succeeds to destroy dataset " \
"with dependent clone outside it."
log_must zfs destroy -R $ctr1
log_must_busy zfs destroy -R $ctr1
datasetexists $ctr1 && \
log_fail "'zfs destroy -R' fails to destroy dataset with clone outside it."
log_note "Verify that 'zfs destroy -r' succeeds to destroy dataset " \
"without dependent clone outside it."
log_must zfs destroy -r $ctr
log_must_busy zfs destroy -r $ctr
datasetexists $ctr && \
log_fail "'zfs destroy -r' fails to destroy dataset with clone outside it."

View File

@ -49,15 +49,11 @@ function cleanup
{
cd $olddir
datasetexists $clone && \
log_must zfs destroy -f $clone
snapexists $snap && \
log_must zfs destroy -f $snap
datasetexists $clone && destroy_dataset $clone -f
snapexists $snap && destroy_dataset $snap -f
for fs in $fs1 $fs2; do
datasetexists $fs && \
log_must zfs destroy -f $fs
datasetexists $fs && destroy_dataset $fs -f
done
for dir in $TESTDIR1 $TESTDIR2; do

View File

@ -51,8 +51,8 @@ function cleanup
if datasetexists $clonesnap; then
log_must zfs promote $fs
fi
datasetexists $clone && log_must zfs destroy $clone
datasetexists $fssnap && log_must zfs destroy $fssnap
datasetexists $clone && destroy_dataset $clone
datasetexists $fssnap && destroy_dataset $fssnap
}
log_assert "Destroy dataset which is namespace-parent of origin should failed."

View File

@ -45,7 +45,7 @@ datasets="$TESTPOOL/$TESTFS1 $TESTPOOL/$TESTFS1/$TESTFS2
function cleanup
{
for ds in $datasets; do
datasetexists $ds && zfs destroy -rf $ds
datasetexists $ds && destroy_dataset $ds -rf
done
}

View File

@ -30,8 +30,8 @@
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && zfs destroy -R $TESTPOOL/$TESTFS1
datasetexists $TESTPOOL/$TESTFS2 && zfs destroy -R $TESTPOOL/$TESTFS2
datasetexists $TESTPOOL/$TESTFS1 && destroy_dataset $TESTPOOL/$TESTFS1 -R
datasetexists $TESTPOOL/$TESTFS2 && destroy_dataset $TESTPOOL/$TESTFS2 -R
poolexists $TESTPOOL2 && zpool destroy $TESTPOOL2
rm -rf $VIRTUAL_DISK
}

View File

@ -30,18 +30,18 @@
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -R $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -R
datasetexists $TESTPOOL/$TESTVOL && \
log_must zfs destroy -Rf $TESTPOOL/$TESTVOL
destroy_dataset $TESTPOOL/$TESTVOL -Rf
}
function setup_snapshots
{
for i in $snaps; do
datasetexists $TESTPOOL/$TESTFS1@snap$i && \
log_must zfs destroy $TESTPOOL/$TESTFS1@snap$i
destroy_dataset $TESTPOOL/$TESTFS1@snap$i
datasetexists $TESTPOOL/$TESTVOL@snap$i && \
log_must zfs destroy $TESTPOOL/$TESTVOL@snap$i
destroy_dataset $TESTPOOL/$TESTVOL@snap$i
log_must zfs snapshot $TESTPOOL/$TESTFS1@snap$i
log_must zfs snapshot $TESTPOOL/$TESTVOL@snap$i
done

View File

@ -39,7 +39,7 @@
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && zfs destroy -R $TESTPOOL/$TESTFS1
datasetexists $TESTPOOL/$TESTFS1 && destroy_dataset $TESTPOOL/$TESTFS1 -R
# reset the livelist sublist size to its original value
set_tunable64 LIVELIST_MAX_ENTRIES $ORIGINAL_MAX
}

View File

@ -102,9 +102,7 @@ function cleanup_testenv
pkill mkbusy
if datasetexists $CTR; then
log_must zfs destroy -Rf $CTR
fi
datasetexists $CTR && destroy_dataset $CTR -Rf
}
#

View File

@ -32,9 +32,7 @@ verify_runnable "both"
function cleanup
{
for snap in $TESTSNAP1 $TESTSNAP2; do
if snapexists "$snap"; then
log_must zfs destroy "$snap"
fi
snapexists "$snap" && destroy_dataset "$snap"
done
}

View File

@ -31,9 +31,7 @@ verify_runnable "both"
function cleanup
{
for snap in $TESTSNAP1 $TESTSNAP2; do
if snapexists "$snap"; then
log_must zfs destroy "$snap"
fi
snapexists "$snap" && destroy_dataset "$snap"
done
find "$MNTPOINT" -type f -delete
rm -f "$FILEDIFF"

View File

@ -47,11 +47,9 @@ function cleanup
{
[[ -e $propfile ]] && rm -f $propfile
datasetexists $clone && \
log_must zfs destroy $clone
datasetexists $clone && destroy_dataset $clone
for snap in $fssnap $volsnap ; do
snapexists $snap && \
log_must zfs destroy $snap
snapexists $snap && destroy_dataset $snap
done
if [[ -n $globalzone ]] ; then
@ -64,8 +62,7 @@ function cleanup
done
else
for fs in $TESTPOOL/$TESTFS1 $TESTPOOL/$TESTFS2 $TESTPOOL/$TESTFS3; do
datasetexists $fs && \
log_must zfs destroy -rf $fs
datasetexists $fs && destroy_dataset $fs -rf
done
fi
}

View File

@ -78,7 +78,5 @@ function depth_fs_setup
#
function depth_fs_cleanup
{
log_must zfs destroy -rR $DEPTH_FS
datasetexists $DEPTH_FS && destroy_dataset $DEPTH_FS -rR
}

View File

@ -45,9 +45,8 @@ verify_runnable "both"
function cleanup
{
if snapexists $TESTPOOL/$TESTFS@$TESTSNAP; then
log_must zfs destroy $TESTPOOL/$TESTFS@$TESTSNAP
fi
snapexists $TESTPOOL/$TESTFS@$TESTSNAP && \
destroy_dataset $TESTPOOL/$TESTFS@$TESTSNAP
}
log_assert "'zfs inherit' should return an error with bad parameters in" \

View File

@ -47,9 +47,7 @@ verify_runnable "both"
function cleanup
{
for ds in $TESTPOOL $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL ; do
if snapexists $ds@$TESTSNAP; then
log_must zfs destroy $ds@$TESTSNAP
fi
snapexists $ds@$TESTSNAP && destroy_dataset $ds@$TESTSNAP
done
cleanup_user_prop $TESTPOOL
}

View File

@ -46,7 +46,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1
poolexists $TESTPOOL1 && log_must destroy_pool $TESTPOOL1
}
log_onexit cleanup

View File

@ -37,9 +37,8 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy $TESTPOOL/$TESTFS1
datasetexists $TESTPOOL/zvol && log_must zfs destroy $TESTPOOL/zvol
datasetexists $TESTPOOL/$TESTFS1 && destroy_dataset $TESTPOOL/$TESTFS1
datasetexists $TESTPOOL/zvol && destroy_dataset $TESTPOOL/zvol
poolexists $TESTPOOL1 && log_must destroy_pool $TESTPOOL1
}
log_onexit cleanup
@ -58,12 +57,12 @@ log_must zpool create -O encryption=on -O keyformat=passphrase \
-O keylocation=file:///$TESTPOOL/pkey $TESTPOOL1 $DISK2
log_must zfs unmount $TESTPOOL/$TESTFS1
log_must zfs unload-key $TESTPOOL/$TESTFS1
log_must_busy zfs unload-key $TESTPOOL/$TESTFS1
log_must zfs unload-key $TESTPOOL/zvol
log_must_busy zfs unload-key $TESTPOOL/zvol
log_must zfs unmount $TESTPOOL1
log_must zfs unload-key $TESTPOOL1
log_must_busy zfs unload-key $TESTPOOL1
log_must zfs load-key -a

View File

@ -38,7 +38,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1
}
log_onexit cleanup

View File

@ -44,7 +44,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1
}
log_onexit cleanup

View File

@ -37,7 +37,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1
}
log_onexit cleanup

View File

@ -39,7 +39,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -r
}
log_onexit cleanup

View File

@ -47,9 +47,7 @@ function cleanup
{
! ismounted $fs && log_must zfs mount $fs
if datasetexists $fs1; then
log_must zfs destroy $fs1
fi
datasetexists $fs1 && destroy_dataset $fs1
if [[ -f $testfile ]]; then
log_must rm -f $testfile

View File

@ -45,12 +45,11 @@ verify_runnable "both"
function cleanup
{
if snapexists $TESTPOOL/$TESTFS@$TESTSNAP; then
log_must_busy zfs destroy $TESTPOOL/$TESTFS@$TESTSNAP
fi
snapexists $TESTPOOL/$TESTFS@$TESTSNAP && \
destroy_dataset $TESTPOOL/$TESTFS@$TESTSNAP
if is_global_zone && datasetexists $TESTPOOL/$TESTVOL; then
log_must_busy zfs destroy $TESTPOOL/$TESTVOL
destroy_dataset $TESTPOOL/$TESTVOL
fi
}

View File

@ -42,7 +42,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -f $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -f
}
log_onexit cleanup

View File

@ -48,7 +48,7 @@ function cleanup
{
log_must_busy zpool export $TESTPOOL
log_must zpool import $TESTPOOL
snapexists $TESTSNAP && log_must zfs destroy $TESTSNAP
snapexists $TESTSNAP && destroy_dataset $TESTSNAP
[[ -d $MNTPSNAP ]] && log_must rmdir $MNTPSNAP
return 0
}

View File

@ -50,8 +50,7 @@ function cleanup
if snapexists $csnap; then
log_must zfs promote $fs
fi
snapexists $snap && \
log_must zfs destroy -rR $snap
snapexists $snap && destroy_dataset $snap -rR
typeset data
for data in $file0 $file1; do

View File

@ -54,8 +54,7 @@ function cleanup
typeset ds
typeset data
for ds in ${snap[*]}; do
snapexists $ds && \
log_must zfs destroy -rR $ds
snapexists $ds && destroy_dataset $ds -rR
done
for data in ${file[*]}; do
[[ -e $data ]] && rm -f $data

View File

@ -53,8 +53,7 @@ function cleanup
typeset ds
typeset data
for ds in ${snap[*]}; do
snapexists $ds && \
log_must zfs destroy -rR $ds
snapexists $ds && destroy_dataset $ds -rR
done
for data in ${file[*]}; do
[[ -e $data ]] && rm -f $data

View File

@ -46,8 +46,8 @@ verify_runnable "both"
function cleanup
{
if datasetexists $fssnap ; then
datasetexists $clone && log_must zfs destroy $clone
log_must zfs destroy $fssnap
datasetexists $clone && destroy_dataset $clone
destroy_dataset $fssnap
fi
if datasetexists $clone ; then
log_must zfs promote $fs

View File

@ -62,13 +62,9 @@ set -A args "" \
function cleanup
{
if datasetexists $clone; then
log_must zfs destroy $clone
fi
datasetexists $clone && destroy_dataset $clone
if datasetexists $recvfs; then
log_must zfs destroy -r $recvfs
fi
datasetexists $recvfs && destroy_dataset $recvfs -r
if snapexists $snap; then
destroy_snapshot $snap

View File

@ -47,8 +47,7 @@ verify_runnable "both"
function cleanup
{
snapexists $snap && \
log_must zfs destroy -rR $snap
snapexists $snap && destroy_dataset $snap -rR
typeset data
for data in $TESTDIR/$TESTFILE0 $TESTDIR/$TESTFILE1; do

View File

@ -42,11 +42,11 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -Rf $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -Rf
datasetexists $TESTPOOL/clone1 && \
log_must zfs destroy -Rf $TESTPOOL/clone1
destroy_dataset $TESTPOOL/clone1 -Rf
datasetexists $TESTPOOL/clone2 && \
log_must zfs destroy -Rf $TESTPOOL/clone2
destroy_dataset $TESTPOOL/clone2 -Rf
}
log_onexit cleanup

View File

@ -36,7 +36,7 @@
function cleanup
{
for ds in $datasets; do
datasetexists $ds && log_must zfs destroy -R $TESTPOOL/$TESTFS1
datasetexists $ds && destroy_dataset $TESTPOOL/$TESTFS1 -R
done
}
function get_prop_mb

View File

@ -48,11 +48,9 @@ function cleanup
{
typeset -i i=0
datasetexists $rst_root && \
log_must zfs destroy -Rf $rst_root
datasetexists $rst_root && destroy_dataset $rst_root -Rf
while (( i < 2 )); do
snapexists ${orig_snap[$i]} && \
log_must zfs destroy -f ${orig_snap[$i]}
snapexists ${orig_snap[$i]} && destroy_dataset ${orig_snap[$i]} -f
log_must rm -f ${bkup[$i]}
(( i = i + 1 ))
@ -63,8 +61,7 @@ function cleanup
function recreate_root
{
datasetexists $rst_root && \
log_must zfs destroy -Rf $rst_root
datasetexists $rst_root && destroy_dataset $rst_root -Rf
if [[ -d $TESTDIR1 ]] ; then
log_must rm -rf $TESTDIR1
fi

View File

@ -50,10 +50,8 @@ function cleanup
typeset ds
while (( i < ${#orig_snap[*]} )); do
snapexists ${rst_snap[$i]} && \
log_must zfs destroy -f ${rst_snap[$i]}
snapexists ${orig_snap[$i]} && \
log_must zfs destroy -f ${orig_snap[$i]}
snapexists ${rst_snap[$i]} && destroy_dataset ${rst_snap[$i]} -f
snapexists ${orig_snap[$i]} && destroy_dataset ${orig_snap[$i]} -f
[[ -e ${bkup[$i]} ]] && \
log_must rm -rf ${bkup[$i]}
@ -61,8 +59,7 @@ function cleanup
done
for ds in $rst_vol $rst_root; do
datasetexists $ds && \
log_must zfs destroy -Rf $ds
datasetexists $ds && destroy_dataset $ds -Rf
done
}

View File

@ -49,7 +49,7 @@ verify_runnable "both"
function cleanup
{
for snap in $snap2 $snap1; do
datasetexists $snap && log_must zfs destroy -rf $snap
datasetexists $snap && destroy_dataset $snap -rf
done
for file in $ibackup $mntpnt/file1 $mntpnt/file2; do
[[ -f $file ]] && log_must rm -f $file

View File

@ -49,8 +49,7 @@ function cleanup
typeset bkup
for snap in $init_snap $inc_snap $init_topsnap $inc_topsnap ; do
snapexists $snap && \
log_must zfs destroy -Rf $snap
snapexists $snap && destroy_dataset $snap -Rf
done
for bkup in $full_bkup $inc_bkup $full_topbkup $inc_topbkup; do

View File

@ -53,12 +53,10 @@ function cleanup
typeset bkup
for snap in $init_snap $inc_snap; do
snapexists $snap && \
log_must zfs destroy -f $snap
snapexists $snap && destroy_dataset $snap -f
done
datasetexists $rst_root && \
log_must zfs destroy -Rf $rst_root
datasetexists $rst_root && destroy_dataset $rst_root -Rf
for bkup in $full_bkup $inc_bkup; do
[[ -e $bkup ]] && \

View File

@ -51,7 +51,7 @@ verify_runnable "both"
function cleanup
{
for snap in $snap2 $snap1; do
datasetexists $snap && log_must zfs destroy -rf $snap
datasetexists $snap && destroy_dataset $snap -rf
done
for file in $fbackup1 $fbackup2 $mntpnt/file1 $mntpnt/file2; do
[[ -f $file ]] && log_must rm -f $file
@ -59,10 +59,10 @@ function cleanup
if is_global_zone; then
datasetexists $TESTPOOL/$TESTFS/$TESTFS1 && \
log_must zfs destroy -rf $TESTPOOL/$TESTFS/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS/$TESTFS1 -rf
else
datasetexists $TESTPOOL/${ZONE_CTR}0 && \
log_must zfs destroy -rf $TESTPOOL/${ZONE_CTR}0
destroy_dataset $TESTPOOL/${ZONE_CTR}0 -rf
fi
}

View File

@ -47,7 +47,7 @@ verify_runnable "both"
function cleanup
{
for snap in $snap2 $snap1; do
datasetexists $snap && log_must zfs destroy -rf $snap
datasetexists $snap && destroy_dataset $snap -rf
done
for file in $ibackup $mntpnt/file1 $mntpnt/file2; do
[[ -f $file ]] && log_must rm -f $file

View File

@ -47,9 +47,7 @@
function cleanup
{
for dset in $rst_snap $rst_fs $orig_snap; do
if datasetexists $dset; then
log_must zfs destroy -fr $dset
fi
datasetexists $dset && destroy_dataset $dset -fr
done
for file in $fbackup $mnt_file $tmp_out; do
@ -59,7 +57,7 @@ function cleanup
done
if datasetexists $TESTPOOL/$TESTFS; then
log_must zfs destroy -Rf $TESTPOOL/$TESTFS
destroy_dataset $TESTPOOL/$TESTFS -Rf
log_must zfs create $TESTPOOL/$TESTFS
log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
fi
@ -99,9 +97,7 @@ for orig_fs in $datasets ; do
log_must eval "zfs send $orig_snap > $fbackup"
for opt in "-v" "-vn"; do
if datasetexists $rst_fs; then
log_must zfs destroy -fr $rst_fs
fi
datasetexists $rst_fs && destroy_dataset $rst_fs -fr
log_note "Check ZFS receive $opt [<filesystem|snapshot>]"
log_must eval "zfs receive $opt $rst_fs < $fbackup > $tmp_out 2>&1"
if [[ $opt == "-v" ]]; then

View File

@ -48,13 +48,10 @@ function cleanup
{
typeset ds
if snapexists $snap; then
log_must zfs destroy $snap
fi
snapexists $snap && destroy_dataset $snap
for ds in $ctr1 $ctr2 $fs1; do
if datasetexists $ds; then
log_must zfs destroy -rf $ds
fi
datasetexists $ds && destroy_dataset $ds -rf
done
if [[ -d $TESTDIR2 ]]; then
rm -rf $TESTDIR2

View File

@ -39,7 +39,7 @@ tpoolfile=$TEST_BASE_DIR/temptank.$$
function cleanup
{
for fs in $src_fs $dst_fs; do
datasetexists $fs && log_must zfs destroy -rf $fs
datasetexists $fs && log_must destroy_dataset $fs -rf
done
zpool destroy $temppool
[[ -f $streamfile ]] && log_must rm -f $streamfile

View File

@ -41,10 +41,10 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -r
datasetexists $TESTPOOL/$TESTFS2 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS2
destroy_dataset $TESTPOOL/$TESTFS2 -r
}
log_onexit cleanup

View File

@ -40,10 +40,10 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -r
datasetexists $TESTPOOL/$TESTFS2 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS2
destroy_dataset $TESTPOOL/$TESTFS2 -r
}
log_onexit cleanup

View File

@ -44,10 +44,10 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -r
datasetexists $TESTPOOL/$TESTFS2 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS2
destroy_dataset $TESTPOOL/$TESTFS2 -r
}
log_onexit cleanup

View File

@ -38,7 +38,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -r
rm -f $sendfile
}

View File

@ -43,10 +43,10 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -r
datasetexists $TESTPOOL/$TESTFS2 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS2
destroy_dataset $TESTPOOL/$TESTFS2 -r
[[ -f $ibackup ]] && log_must rm -f $ibackup
[[ -f $ibackup_trunc ]] && log_must rm -f $ibackup_trunc

View File

@ -38,10 +38,10 @@ verify_runnable "both"
function cleanup
{
snapexists $snap && log_must_busy zfs destroy -f $snap
snapexists $snap && destroy_dataset $snap -f
datasetexists $TESTPOOL/$TESTFS1 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS1
destroy_dataset $TESTPOOL/$TESTFS1 -r
}
log_onexit cleanup

View File

@ -108,13 +108,11 @@ function cleanup
((i = i + 1))
done
if snapexists $TESTPOOL/$TESTFS@snapshot; then
log_must zfs destroy -fR $TESTPOOL/$TESTFS@snapshot
fi
snapexists $TESTPOOL/$TESTFS@snapshot && \
destroy_dataset $TESTPOOL/$TESTFS@snapshot -fR
if datasetexists $TESTPOOL/$RECVFS; then
log_must zfs destroy -r $TESTPOOL/$RECVFS
fi
datasetexists $TESTPOOL/$RECVFS && \
destroy_dataset $TESTPOOL/$RECVFS -r
}
function cmp_data #<$1 src data, $2 tgt data>

View File

@ -44,7 +44,7 @@ verify_runnable "both"
function cleanup
{
datasetexists $snap && log_must zfs destroy $snap
datasetexists $snap && destroy_dataset $snap
}
log_assert "'zfs rename' can address the abbreviated snapshot name."

View File

@ -46,9 +46,8 @@ verify_runnable "both"
function cleanup
{
if datasetexists $TESTPOOL/$TESTFS ; then
log_must zfs destroy -Rf $TESTPOOL/$TESTFS
fi
datasetexists $TESTPOOL/$TESTFS && \
destroy_dataset $TESTPOOL/$TESTFS -Rf
log_must zfs create $TESTPOOL/$TESTFS
log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS

View File

@ -47,12 +47,11 @@ function cleanup
{
typeset -i i=0
while ((i < ${#datasets[@]})); do
if datasetexists ${datasets[$i]}@snap ; then
log_must zfs destroy ${datasets[$i]}@snap
fi
if datasetexists ${datasets[$i]}@snap-new ; then
log_must zfs destroy ${datasets[$i]}@snap-new
fi
datasetexists ${datasets[$i]}@snap && \
destroy_dataset ${datasets[$i]}@snap
datasetexists ${datasets[$i]}@snap-new && \
destroy_dataset ${datasets[$i]}@snap-new
((i += 1))
done

View File

@ -46,19 +46,18 @@ verify_runnable "both"
function additional_cleanup
{
if datasetexists $TESTPOOL/notexist ; then
log_must zfs destroy -Rf $TESTPOOL/notexist
fi
datasetexists $TESTPOOL/notexist && \
destroy_dataset $TESTPOOL/notexist -Rf
datasetexists $TESTPOOL/$TESTFS && \
destroy_dataset $TESTPOOL/$TESTFS -Rf
if datasetexists $TESTPOOL/$TESTFS ; then
log_must zfs destroy -Rf $TESTPOOL/$TESTFS
fi
log_must zfs create $TESTPOOL/$TESTFS
if is_global_zone ; then
if datasetexists $TESTPOOL/$TESTVOL ; then
log_must zfs destroy -Rf $TESTPOOL/$TESTVOL
fi
datasetexists $TESTPOOL/$TESTVOL && \
destroy_dataset $TESTPOOL/$TESTVOL -Rf
log_must zfs create -V $VOLSIZE $TESTPOOL/$TESTVOL
fi
}

View File

@ -46,21 +46,17 @@ verify_runnable "both"
function cleanup
{
if datasetexists $TESTPOOL/$TESTCTR@snap-new ; then
log_must zfs destroy -f $TESTPOOL/$TESTCTR@snap-new
fi
datasetexists $TESTPOOL/$TESTCTR@snap-new && \
destroy_dataset $TESTPOOL/$TESTCTR@snap-new -f
if datasetexists $TESTPOOL/$TESTCTR@snap ; then
log_must zfs destroy -f $TESTPOOL/$TESTCTR@snap
fi
datasetexists $TESTPOOL/$TESTCTR@snap && \
destroy_dataset $TESTPOOL/$TESTCTR@snap -f
if datasetexists $TESTPOOL@snap-new ; then
log_must zfs destroy -f $TESTPOOL@snap-new
fi
datasetexists $TESTPOOL@snap-new && \
destroy_dataset $TESTPOOL@snap-new -f
if datasetexists $TESTPOOL@snap ; then
log_must zfs destroy -f $TESTPOOL@snap
fi
datasetexists $TESTPOOL@snap && \
destroy_dataset $TESTPOOL@snap -f
}
log_assert "zfs rename -r can rename snapshot when child datasets" \

View File

@ -42,9 +42,9 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS2 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS2
destroy_dataset $TESTPOOL/$TESTFS2 -r
datasetexists $TESTPOOL/$TESTFS3 && \
log_must zfs destroy -r $TESTPOOL/$TESTFS3
destroy_dataset $TESTPOOL/$TESTFS3 -r
}
log_onexit cleanup

Some files were not shown because too many files have changed in this diff Show More