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 8464de1315
commit ec1b033413
241 changed files with 420 additions and 652 deletions

View File

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

View File

@ -34,7 +34,7 @@ function create_testfs
function destroy_testfs function destroy_testfs
{ {
if datasetexists $TESTPOOL/$TESTFS ; then 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 rm -rf $TESTDIR || log_unresolved Could not remove $TESTDIR
fi fi
} }

View File

@ -30,7 +30,7 @@ create_clone
function cleanup function cleanup
{ {
datasetexists $TESTPOOL/$TESTFS@$TESTSNAP && \ 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 \ log_must_program $TESTPOOL $ZCP_ROOT/lua_core/tst.exists.zcp \

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -51,9 +51,7 @@ function cleanup
destroy_pool $TESTPOOL1 destroy_pool $TESTPOOL1
fi fi
if datasetexists $vol; then datasetexists $vol && destroy_dataset $vol
log_must zfs destroy $vol
fi
} }
log_assert "Verify that ZFS volume space used by multiple copies is charged correctly." 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 log_must umount $mntp
fi fi
if datasetexists $vol; then datasetexists $vol && destroy_dataset $vol
log_must zfs destroy $vol
fi
if [[ -d $mntp ]]; then if [[ -d $mntp ]]; then
rm -rf $mntp rm -rf $mntp

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -51,8 +51,8 @@ function cleanup
if datasetexists $clonesnap; then if datasetexists $clonesnap; then
log_must zfs promote $fs log_must zfs promote $fs
fi fi
datasetexists $clone && log_must zfs destroy $clone datasetexists $clone && destroy_dataset $clone
datasetexists $fssnap && log_must zfs destroy $fssnap datasetexists $fssnap && destroy_dataset $fssnap
} }
log_assert "Destroy dataset which is namespace-parent of origin should failed." 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 function cleanup
{ {
for ds in $datasets; do for ds in $datasets; do
datasetexists $ds && zfs destroy -rf $ds datasetexists $ds && destroy_dataset $ds -rf
done done
} }

View File

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

View File

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

View File

@ -39,7 +39,7 @@
function cleanup 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 # reset the livelist sublist size to its original value
set_tunable64 LIVELIST_MAX_ENTRIES $ORIGINAL_MAX set_tunable64 LIVELIST_MAX_ENTRIES $ORIGINAL_MAX
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -78,7 +78,5 @@ function depth_fs_setup
# #
function depth_fs_cleanup 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 function cleanup
{ {
if snapexists $TESTPOOL/$TESTFS@$TESTSNAP; then snapexists $TESTPOOL/$TESTFS@$TESTSNAP && \
log_must zfs destroy $TESTPOOL/$TESTFS@$TESTSNAP destroy_dataset $TESTPOOL/$TESTFS@$TESTSNAP
fi
} }
log_assert "'zfs inherit' should return an error with bad parameters in" \ log_assert "'zfs inherit' should return an error with bad parameters in" \

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -39,7 +39,7 @@ tpoolfile=$TEST_BASE_DIR/temptank.$$
function cleanup function cleanup
{ {
for fs in $src_fs $dst_fs; do 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 done
zpool destroy $temppool zpool destroy $temppool
[[ -f $streamfile ]] && log_must rm -f $streamfile [[ -f $streamfile ]] && log_must rm -f $streamfile

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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