]>
Commit | Line | Data |
---|---|---|
50c957f7 NB |
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 | ||
75d6b7dd NB |
23 | # |
24 | # Copyright (c) 2016 by Lawrence Livermore National Security, LLC. | |
25 | # Use is subject to license terms. | |
26 | # | |
27 | ||
50c957f7 NB |
28 | . $STF_SUITE/include/libtest.shlib |
29 | ||
30 | # | |
31 | # DESCRIPTION: | |
32 | # Verify that extended attributes can use extra bonus space of a large | |
33 | # dnode without kicking in a spill block. | |
34 | # | |
35 | # STRATEGY: | |
36 | # 1. Create a file system with xattr=sa | |
37 | # 2. Set dnodesize to a legal literal value | |
38 | # 3. Create a file | |
39 | # 4 Store an xattr that fits within the dnode size | |
40 | # 4. Repeat 2-3 for all legal literal values of dnodesize values | |
41 | # 5. Unmount the file system | |
42 | # 6. Use zdb to check for missing SPILL_BLKPTR flag | |
43 | # | |
44 | ||
45 | TEST_FS=$TESTPOOL/large_dnode | |
46 | ||
47 | verify_runnable "both" | |
48 | ||
49 | function cleanup | |
50 | { | |
c1d9abf9 | 51 | datasetexists $TEST_FS && log_must zfs destroy $TEST_FS |
50c957f7 NB |
52 | } |
53 | ||
54 | log_onexit cleanup | |
55 | log_assert "extended attributes use extra bonus space of a large dnode" | |
56 | ||
c1d9abf9 | 57 | log_must zfs create -o xattr=sa $TEST_FS |
50c957f7 NB |
58 | |
59 | # Store dnode size minus 512 in an xattr | |
60 | set -A xattr_sizes "512" "1536" "3584" "7680" "15872" | |
61 | set -A prop_values "1k" "2k" "4k" "8k" "16k" | |
62 | set -A inodes | |
63 | ||
64 | for ((i=0; i < ${#prop_values[*]}; i++)) ; do | |
65 | prop_val=${prop_values[$i]} | |
66 | file=/$TEST_FS/file.$prop_val | |
c1d9abf9 | 67 | log_must zfs set dnsize=$prop_val $TEST_FS |
50c957f7 NB |
68 | touch $file |
69 | xattr_size=${xattr_sizes[$i]} | |
70 | xattr_name=user.foo | |
71 | xattr_val=$(dd if=/dev/urandom bs=1 count=$xattr_size | | |
72 | openssl enc -a -A) | |
73 | log_must setfattr -n $xattr_name -v 0s$xattr_val $file | |
74 | inodes[$i]=$(ls -li $file | awk '{print $1}') | |
75 | done | |
76 | ||
c1d9abf9 | 77 | log_must zfs umount $TEST_FS |
50c957f7 NB |
78 | |
79 | for ((i=0; i < ${#inodes[*]}; i++)) ; do | |
c1d9abf9 | 80 | log_mustnot eval "zdb -dddd $TEST_FS ${inodes[$i]} | grep SPILL_BLKPTR" |
50c957f7 NB |
81 | done |
82 | ||
83 | log_pass "extended attributes use extra bonus space of a large dnode" |