]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - zfs/tests/zfs-tests/tests/functional/features/async_destroy/async_destroy_001_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 (c) 2013, 2014 by Delphix. All rights reserved.
27 .
$STF_SUITE/include
/libtest.shlib
31 # Exercise the traversal suspend/resume code in async_destroy by
32 # destroying a file system that has more blocks than we can free
36 # 1. Create a file system
37 # 2. Set recordsize to 512 to create the maximum number of blocks
38 # 3. Set compression to off to force zero-ed blocks to be written
39 # 4. dd a lot of data from /dev/zero to the file system
40 # 5. Destroy the file system
41 # 6. Wait for the freeing property to go to 0
42 # 7. Use zdb to check for leaked blocks
45 TEST_FS
=$TESTPOOL/async_destroy
47 verify_runnable
"both"
51 datasetexists
$TEST_FS && log_must
$ZFS destroy
$TEST_FS
55 log_assert
"async_destroy can suspend and resume traversal"
57 log_must
$ZFS create
-o recordsize
=512 -o compression
=off
$TEST_FS
60 log_must
$DD bs
=1024k count
=1024 if=/dev
/zero of
=/$TEST_FS/file
62 log_must
$ZFS destroy
$TEST_FS
65 # We monitor the freeing property, to verify we can see blocks being
66 # freed while the suspend/resume code is exerciesd.
70 while [[ $
((SECONDS
- t0
)) -lt 10 ]]; do
71 [[ "0" != "$($ZPOOL list -Ho freeing $TESTPOOL)" ]] && ((count
++))
72 [[ $count -gt 1 ]] && break
76 [[ $count -eq 0 ]] && log_fail
"Freeing property remained empty"
78 # Wait for everything to be freed.
79 while [[ "0" != "$($ZPOOL list -Ho freeing $TESTPOOL)" ]]; do
80 [[ $
((SECONDS
- t0
)) -gt 180 ]] && \
81 log_fail
"Timed out waiting for freeing to drop to zero"
84 # Check for leaked blocks.
85 log_must
$ZDB -b $TESTPOOL
87 log_pass
"async_destroy can suspend and resume traversal"