3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright (c) 2012 by Delphix. All rights reserved.
17 .
$STF_SUITE/include
/libtest.shlib
18 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_destroy
/zfs_destroy.cfg
19 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_destroy
/zfs_destroy_common.kshlib
21 ################################################################################
23 # Deferred destroyed snapshots remain until the last hold is released.
25 # 1. Create test environment without clones.
26 # 2. 'zfs hold <tag1> <snap>'
27 # 3. 'zfs destroy -d <snap>'
28 # 4. Sequence of holds/releases including invalid ones that should fail.
29 # 4. Verify snapshot still exists.
30 # 5. Release all holds.
31 # 6. Verify that the snapshot is destroyed.
33 ################################################################################
35 log_assert
"deferred destroyed snapshots remain until last hold is released"
36 log_onexit cleanup_testenv
40 for dstype
in FS VOL
; do
41 snap
=$
(eval echo \$
${dstype}SNAP
)
42 log_must
$ZFS hold zfstest1
$snap
43 log_must
$ZFS destroy
-d $snap
44 log_must datasetexists
$snap
45 log_must
eval "[[ $(get_prop defer_destroy $snap) == 'on' ]]"
47 log_must
$ZFS hold zfstest2
$snap
48 log_mustnot
$ZFS hold zfstest1
$snap
49 log_mustnot
$ZFS hold zfstest2
$snap
51 log_must
$ZFS release zfstest1
$snap
52 log_must datasetexists
$snap
53 log_mustnot
$ZFS release zfstest1
$snap
54 log_must datasetexists
$snap
55 log_mustnot
$ZFS release zfstest3
$snap
56 log_must datasetexists
$snap
58 log_must
$ZFS release zfstest2
$snap
59 log_mustnot datasetexists
$snap
62 log_pass
"deferred destroyed snapshots remain until last hold is released"