]> git.proxmox.com Git - mirror_zfs-debian.git/blob - tests/zfs-tests/tests/functional/no_space/enospc_003_pos.ksh
New upstream version 0.7.2
[mirror_zfs-debian.git] / tests / zfs-tests / tests / functional / no_space / enospc_003_pos.ksh
1 #!/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
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.
8 #
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.
13 #
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]
19 #
20 # CDDL HEADER END
21 #
22
23 #
24 # Copyright 2017, loli10K. All rights reserved.
25 #
26
27 . $STF_SUITE/include/libtest.shlib
28 . $STF_SUITE/tests/functional/no_space/enospc.cfg
29 . $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
30
31 #
32 # DESCRIPTION:
33 # ENOSPC is returned on pools with large physical block size and small
34 # recordsize.
35 #
36 # STRATEGY:
37 # 1. Create a pool with property ashift=13 (8K block size)
38 # 2. Set property recordsize=512 and copies=3 on the root dataset
39 # 3. Write a file until the file system is full
40 # 4. Verify the return code is ENOSPC
41 #
42
43 verify_runnable "both"
44
45 function cleanup
46 {
47 log_must zpool destroy $TESTPOOL1
48 log_must rm -f $disk
49 }
50
51 log_onexit cleanup
52
53 log_assert "ENOSPC is returned on pools with large physical block size"
54
55 disk=$TEST_BASE_DIR/$FILEDISK0
56 # we need a device big enough to test this or failure will not trigger
57 size="512m"
58 log_must mkfile $size $disk
59
60 log_must zpool create $TESTPOOL1 -o ashift=13 $disk
61 log_must zfs set mountpoint=$TESTDIR $TESTPOOL1
62 log_must zfs set compression=off $TESTPOOL1
63 log_must zfs set recordsize=512 $TESTPOOL1
64 log_must zfs set copies=3 $TESTPOOL1
65
66 log_note "Writing file: $TESTFILE0 until ENOSPC."
67 file_write -o create -f $TESTDIR/$TESTFILE0 -b $BLOCKSZ \
68 -c $NUM_WRITES -d $DATA
69 ret=$?
70
71 (( $ret != $ENOSPC )) && \
72 log_fail "$TESTFILE0 returned: $ret rather than ENOSPC."
73
74 log_pass "ENOSPC returned as expected."