Skip to content

Commit

Permalink
10392 large_dnode tests
Browse files Browse the repository at this point in the history
Reviewed by: Jerry Jelinek <[email protected]>
Reviewed by: Toomas Soome <[email protected]>
Reviewed by: Andy Fiddaman <[email protected]>
Reviewed by: Kody Kantor <[email protected]>
Approved by: Dan McDonald <[email protected]>
  • Loading branch information
nedbass authored and Dan McDonald committed Feb 19, 2019
1 parent ca4fa6c commit 0774d90
Show file tree
Hide file tree
Showing 22 changed files with 774 additions and 3 deletions.
21 changes: 21 additions & 0 deletions usr/src/pkg/manifests/system-test-zfstest.mf
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ dir path=opt/zfs-tests/tests/functional/history
dir path=opt/zfs-tests/tests/functional/holes
dir path=opt/zfs-tests/tests/functional/inheritance
dir path=opt/zfs-tests/tests/functional/inuse
dir path=opt/zfs-tests/tests/functional/large_dnode
dir path=opt/zfs-tests/tests/functional/large_files
dir path=opt/zfs-tests/tests/functional/largest_pool
dir path=opt/zfs-tests/tests/functional/libzfs
Expand Down Expand Up @@ -2202,6 +2203,26 @@ file path=opt/zfs-tests/tests/functional/inuse/inuse_007_pos mode=0555
file path=opt/zfs-tests/tests/functional/inuse/inuse_008_pos mode=0555
file path=opt/zfs-tests/tests/functional/inuse/inuse_009_pos mode=0555
file path=opt/zfs-tests/tests/functional/inuse/setup mode=0555
file path=opt/zfs-tests/tests/functional/large_dnode/cleanup mode=0555
file path=opt/zfs-tests/tests/functional/large_dnode/large_dnode_001_pos \
mode=0555
file path=opt/zfs-tests/tests/functional/large_dnode/large_dnode_002_pos \
mode=0555
file path=opt/zfs-tests/tests/functional/large_dnode/large_dnode_003_pos \
mode=0555
file path=opt/zfs-tests/tests/functional/large_dnode/large_dnode_004_neg \
mode=0555
file path=opt/zfs-tests/tests/functional/large_dnode/large_dnode_005_pos \
mode=0555
file path=opt/zfs-tests/tests/functional/large_dnode/large_dnode_006_pos \
mode=0555
file path=opt/zfs-tests/tests/functional/large_dnode/large_dnode_007_neg \
mode=0555
file path=opt/zfs-tests/tests/functional/large_dnode/large_dnode_008_pos \
mode=0555
file path=opt/zfs-tests/tests/functional/large_dnode/large_dnode_009_pos \
mode=0555
file path=opt/zfs-tests/tests/functional/large_dnode/setup mode=0555
file path=opt/zfs-tests/tests/functional/large_files/cleanup mode=0555
file path=opt/zfs-tests/tests/functional/large_files/large_files_001_pos \
mode=0555
Expand Down
4 changes: 4 additions & 0 deletions usr/src/test/zfs-tests/runfiles/delphix.run
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ tests = ['inuse_001_pos', 'inuse_003_pos', 'inuse_004_pos',
'inuse_009_pos']
post =

[/opt/zfs-tests/tests/functional/large_dnode]
tests = ['large_dnode_001_pos', 'large_dnode_003_pos',
'large_dnode_004_neg', 'large_dnode_005_pos', 'large_dnode_007_neg']

[/opt/zfs-tests/tests/functional/large_files]
tests = ['large_files_001_pos']

Expand Down
4 changes: 4 additions & 0 deletions usr/src/test/zfs-tests/runfiles/omnios.run
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ tests = ['inuse_001_pos', 'inuse_003_pos', 'inuse_004_pos',
'inuse_009_pos']
post =

[/opt/zfs-tests/tests/functional/large_dnode]
tests = ['large_dnode_001_pos', 'large_dnode_003_pos',
'large_dnode_004_neg', 'large_dnode_005_pos', 'large_dnode_007_neg']

[/opt/zfs-tests/tests/functional/large_files]
tests = ['large_files_001_pos']

Expand Down
4 changes: 4 additions & 0 deletions usr/src/test/zfs-tests/runfiles/openindiana.run
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ tests = ['inuse_001_pos', 'inuse_003_pos', 'inuse_004_pos',
'inuse_009_pos']
post =

[/opt/zfs-tests/tests/functional/large_dnode]
tests = ['large_dnode_001_pos', 'large_dnode_003_pos',
'large_dnode_004_neg', 'large_dnode_005_pos', 'large_dnode_007_neg']

[/opt/zfs-tests/tests/functional/large_files]
tests = ['large_files_001_pos']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ typeset -a properties=(
"feature@skein"
"feature@edonr"
"feature@device_removal"
"feature@large_dnode"
)
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ function check_fs_perm
verify_fs_canmount $user $perm $fs
ret=$?
;;
dnodesize)
verify_fs_dnodesize $user $perm $fs
ret=$?
;;
recordsize)
verify_fs_recordsize $user $perm $fs
ret=$?
Expand Down Expand Up @@ -1098,6 +1102,21 @@ function verify_fs_recordsize
return 0
}

function verify_fs_dnodesize
{
typeset user=$1
typeset perm=$2
typeset fs=$3
value="2k"

user_run $user zfs set dnodesize=$value $fs
if [[ $value != $(get_prop dnodesize $fs) ]]; then
return 1
fi

return 0
}

function verify_fs_quota
{
typeset user=$1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ set -A perms create true false \
allow true true \
quota true false \
reservation true true \
dnodesize true false \
recordsize true false \
mountpoint true false \
checksum true true \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ log_onexit cleanup
set -A perms create snapshot mount send allow quota reservation \
recordsize mountpoint checksum compression canmount atime \
devices exec volsize setuid readonly snapdir userprop \
aclmode aclinherit rollback clone rename promote \
aclmode aclinherit rollback clone rename promote dnodesize \
zoned xattr receive destroy sharenfs share

log_must zpool set delegation=off $TESTPOOL
Expand Down
21 changes: 21 additions & 0 deletions usr/src/test/zfs-tests/tests/functional/large_dnode/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#

include $(SRC)/Makefile.master

ROOTOPTPKG = $(ROOT)/opt/zfs-tests
TARGETDIR = $(ROOTOPTPKG)/tests/functional/large_dnode

include $(SRC)/test/zfs-tests/Makefile.com
25 changes: 25 additions & 0 deletions usr/src/test/zfs-tests/tests/functional/large_dnode/cleanup.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

. $STF_SUITE/include/libtest.shlib

default_cleanup
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

. $STF_SUITE/include/libtest.shlib

#
# DESCRIPTION:
# Verify that the dnode sizes of newly created files are consistent
# with the dnodesize dataset property.
#
# STRATEGY:
# 1. Create a file system
# 2. Set dnodesize to a legal literal value
# 3. Create a file
# 4. Repeat 2-3 for all legal literal values of dnodesize values
# 5. Unmount the file system
# 6. Use zdb to check expected dnode sizes
#

TEST_FS=$TESTPOOL/large_dnode

verify_runnable "both"

function cleanup
{
datasetexists $TEST_FS && log_must zfs destroy $TEST_FS
}

log_onexit cleanup
log_assert "dnode sizes are consistent with dnodesize dataset property"

log_must zfs create $TEST_FS

set -A dnsizes "512" "1k" "2k" "4k" "8k" "16k"
set -A inodes

for ((i=0; i < ${#dnsizes[*]}; i++)) ; do
size=${dnsizes[$i]}
if [[ $size == "512" ]] ; then
size="legacy"
fi
file=/$TEST_FS/file.$size
log_must zfs set dnsize=$size $TEST_FS
touch $file
inodes[$i]=$(ls -li $file | awk '{print $1}')
done

log_must zfs umount $TEST_FS

for ((i=0; i < ${#dnsizes[*]}; i++)) ; do
dnsize=$(zdb -dddd $TEST_FS ${inodes[$i]} |
awk '/ZFS plain file/ {print $6}' | tr K k)
if [[ "$dnsize" != "${dnsizes[$i]}" ]]; then
log_fail "dnode size is $dnsize (expected ${dnsizes[$i]})"
fi
done

log_pass "dnode sizes are consistent with dnodesize dataset property"
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

. $STF_SUITE/include/libtest.shlib

#
# DESCRIPTION:
# Verify that extended attributes can use extra bonus space of a large
# dnode without kicking in a spill block.
#
# STRATEGY:
# 1. Create a file system with xattr=sa
# 2. Set dnodesize to a legal literal value
# 3. Create a file
# 4 Store an xattr that fits within the dnode size
# 4. Repeat 2-3 for all legal literal values of dnodesize values
# 5. Unmount the file system
# 6. Use zdb to check for missing SPILL_BLKPTR flag
#

TEST_FS=$TESTPOOL/large_dnode

verify_runnable "both"

function cleanup
{
datasetexists $TEST_FS && log_must zfs destroy $TEST_FS
}

log_onexit cleanup
log_assert "extended attributes use extra bonus space of a large dnode"

log_must zfs create -o xattr=sa $TEST_FS

# Store dnode size minus 512 in an xattr
set -A xattr_sizes "512" "1536" "3584" "7680" "15872"
set -A prop_values "1k" "2k" "4k" "8k" "16k"
set -A inodes

for ((i=0; i < ${#prop_values[*]}; i++)) ; do
prop_val=${prop_values[$i]}
file=/$TEST_FS/file.$prop_val
log_must zfs set dnsize=$prop_val $TEST_FS
touch $file
xattr_size=${xattr_sizes[$i]}
xattr_name=user.foo
xattr_val=$(dd if=/dev/urandom bs=1 count=$xattr_size |
openssl enc -a -A)
log_must setfattr -n $xattr_name -v 0s$xattr_val $file
inodes[$i]=$(ls -li $file | awk '{print $1}')
done

log_must zfs umount $TEST_FS

for ((i=0; i < ${#inodes[*]}; i++)) ; do
log_mustnot eval "zdb -dddd $TEST_FS ${inodes[$i]} | grep SPILL_BLKPTR"
done

log_pass "extended attributes use extra bonus space of a large dnode"
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

. $STF_SUITE/include/libtest.shlib

verify_runnable "both"

function cleanup
{
if datasetexists $LDNPOOL ; then
log_must zpool destroy -f $LDNPOOL
fi
}

log_onexit cleanup

log_assert "feature correctly switches between enabled and active"

LDNPOOL=ldnpool
LDNFS=$LDNPOOL/large_dnode
log_must mkfile 64M $TESTDIR/$LDNPOOL
log_must zpool create $LDNPOOL $TESTDIR/$LDNPOOL


state=$(zpool list -Ho feature@large_dnode $LDNPOOL)
if [[ "$state" != "enabled" ]]; then
log_fail "large_dnode has state $state (expected enabled)"
fi

log_must zfs create -o dnodesize=1k $LDNFS
log_must touch /$LDNFS/foo
log_must zfs unmount $LDNFS

state=$(zpool list -Ho feature@large_dnode $LDNPOOL)
if [[ "$state" != "active" ]]; then
log_fail "large_dnode has state $state (expected active)"
fi

log_must zfs destroy $LDNFS

state=$(zpool list -Ho feature@large_dnode $LDNPOOL)
if [[ "$state" != "enabled" ]]; then
log_fail "large_dnode has state $state (expected enabled)"
fi

log_pass
Loading

0 comments on commit 0774d90

Please sign in to comment.