]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - tests/zfs-tests/tests/functional/snapshot/snapshot_008_pos.ksh
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 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
33 .
$STF_SUITE/tests
/functional
/snapshot
/snapshot.cfg
37 # Verify that destroying snapshots returns space to the pool.
40 # 1. Create a file system and populate it while snapshotting.
41 # 2. Destroy the snapshots and remove the files.
42 # 3. Verify the space returns to the pool.
45 verify_runnable
"both"
50 while [[ $i -lt $COUNT ]]; do
53 log_must zfs destroy
$SNAPFS.
$i
58 [[ -e $TESTDIR ]] && \
59 log_must
rm -rf $TESTDIR/* > /dev
/null
2>&1
62 log_assert
"Verify that destroying snapshots returns space to the pool."
66 [[ -n $TESTDIR ]] && \
67 log_must
rm -rf $TESTDIR/* > /dev
/null
2>&1
71 orig_size
=`get_prop available $TESTPOOL`
73 log_note
"Populate the $TESTDIR directory"
75 while [[ $i -lt $COUNT ]]; do
76 log_must file_write
-o create
-f $TESTDIR/file$i \
77 -b $BLOCKSZ -c $NUM_WRITES -d $i
79 log_must zfs snapshot
$SNAPFS.
$i
84 while [[ $i -lt $COUNT ]]; do
85 log_must
rm -rf $TESTDIR/file$i > /dev
/null
2>&1
86 log_must zfs destroy
$SNAPFS.
$i
91 wait_freeing
$TESTPOOL
94 new_size
=`get_prop available $TESTPOOL`
96 typeset
-i tolerance
=0
98 (( tolerance
= new_size
- orig_size
))
99 if (( tolerance
> LIMIT
)); then
100 log_fail
"Space not freed. ($orig_size != $new_size)"
103 log_pass
"After destroying snapshots, the space is returned to the pool."