5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
27 .
$STF_SUITE/include
/libtest.shlib
28 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_destroy
/zfs_destroy.cfg
29 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_destroy
/zfs_destroy_common.kshlib
31 ################################################################################
33 # When using 'zfs destroy -R' on a file system hierarchy that includes a
34 # snapshot and a clone of that snapshot, and the snapshot has been
35 # defer-destroyed, make sure that the 'zfs destroy -R' works as expected.
36 # In particular make sure that libzfs is not confused by the fact that the
37 # kernel will automatically remove the defer-destroyed snapshot when the
40 # 1. Create test environment.
41 # 2. Create a clone of the snapshot.
42 # 3. 'zfs destroy -d <snap>'
44 # 5. Verify that the snapshot and clone are destroyed.
46 ################################################################################
48 function test_clone_run
52 ds
=$
(eval echo \$
${dstype})
53 snap
=$
(eval echo \$
${dstype}SNAP
)
54 clone
=$
(eval echo \$
${dstype}CLONE
)
55 log_must zfs destroy
-d $snap
56 log_must datasetexists
$snap
57 log_must_busy zfs destroy
-R $clone
58 log_mustnot datasetexists
$snap
59 log_mustnot datasetexists
$clone
62 log_assert
"'zfs destroy -R' works on deferred destroyed snapshots"
63 log_onexit cleanup_testenv
67 for dstype
in FS VOL
; do
68 if [[ $dstype == VOL
]]; then
69 if is_global_zone
; then
70 test_clone_run
$dstype
73 test_clone_run
$dstype
77 log_pass
"'zfs destroy -R' works on deferred destroyed snapshots"