diff --git a/usr/src/pkg/manifests/system-test-zfstest.mf b/usr/src/pkg/manifests/system-test-zfstest.mf index 88f6f6bdc6bf..19f249965a28 100644 --- a/usr/src/pkg/manifests/system-test-zfstest.mf +++ b/usr/src/pkg/manifests/system-test-zfstest.mf @@ -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 @@ -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 diff --git a/usr/src/test/zfs-tests/runfiles/delphix.run b/usr/src/test/zfs-tests/runfiles/delphix.run index 57ed0506e31b..1f7ce39c8c1c 100644 --- a/usr/src/test/zfs-tests/runfiles/delphix.run +++ b/usr/src/test/zfs-tests/runfiles/delphix.run @@ -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'] diff --git a/usr/src/test/zfs-tests/runfiles/omnios.run b/usr/src/test/zfs-tests/runfiles/omnios.run index ca3181af7712..a8bad95433d3 100644 --- a/usr/src/test/zfs-tests/runfiles/omnios.run +++ b/usr/src/test/zfs-tests/runfiles/omnios.run @@ -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'] diff --git a/usr/src/test/zfs-tests/runfiles/openindiana.run b/usr/src/test/zfs-tests/runfiles/openindiana.run index 43a2a641c81e..fc3131dc7688 100644 --- a/usr/src/test/zfs-tests/runfiles/openindiana.run +++ b/usr/src/test/zfs-tests/runfiles/openindiana.run @@ -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'] diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg index f65d065d7c4d..76b7a1582b05 100644 --- a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg @@ -70,4 +70,5 @@ typeset -a properties=( "feature@skein" "feature@edonr" "feature@device_removal" + "feature@large_dnode" ) diff --git a/usr/src/test/zfs-tests/tests/functional/delegate/delegate_common.kshlib b/usr/src/test/zfs-tests/tests/functional/delegate/delegate_common.kshlib index 771ada74a056..71d7a45c2ff9 100644 --- a/usr/src/test/zfs-tests/tests/functional/delegate/delegate_common.kshlib +++ b/usr/src/test/zfs-tests/tests/functional/delegate/delegate_common.kshlib @@ -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=$? @@ -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 diff --git a/usr/src/test/zfs-tests/tests/functional/delegate/zfs_allow_010_pos.ksh b/usr/src/test/zfs-tests/tests/functional/delegate/zfs_allow_010_pos.ksh index 98e58f9097c5..030d7a91799a 100644 --- a/usr/src/test/zfs-tests/tests/functional/delegate/zfs_allow_010_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/delegate/zfs_allow_010_pos.ksh @@ -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 \ diff --git a/usr/src/test/zfs-tests/tests/functional/delegate/zfs_allow_012_neg.ksh b/usr/src/test/zfs-tests/tests/functional/delegate/zfs_allow_012_neg.ksh index 31e51c819ce0..97561821f3d3 100644 --- a/usr/src/test/zfs-tests/tests/functional/delegate/zfs_allow_012_neg.ksh +++ b/usr/src/test/zfs-tests/tests/functional/delegate/zfs_allow_012_neg.ksh @@ -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 diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/Makefile b/usr/src/test/zfs-tests/tests/functional/large_dnode/Makefile new file mode 100644 index 000000000000..fa523a827953 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/Makefile @@ -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 diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/cleanup.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/cleanup.ksh new file mode 100755 index 000000000000..61caf3910042 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/cleanup.ksh @@ -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 diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_001_pos.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_001_pos.ksh new file mode 100755 index 000000000000..c07f4e8d7421 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_001_pos.ksh @@ -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" diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_002_pos.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_002_pos.ksh new file mode 100755 index 000000000000..1dd8d888c369 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_002_pos.ksh @@ -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" diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_003_pos.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_003_pos.ksh new file mode 100755 index 000000000000..a938c7de7c4e --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_003_pos.ksh @@ -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 diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_004_neg.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_004_neg.ksh new file mode 100755 index 000000000000..1006ae6af54a --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_004_neg.ksh @@ -0,0 +1,68 @@ +#!/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 +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Copyright (c) 2013, 2016 by Delphix. All rights reserved. +# + +. $STF_SUITE/include/libtest.shlib + +verify_runnable "both" + +TEST_FS=$TESTPOOL/large_dnode +TEST_SNAP=$TESTPOOL/large_dnode@ldnsnap +TEST_STREAM=$TESTDIR/ldnsnap + +function cleanup +{ + if datasetexists $TEST_FS ; then + log_must zfs destroy -r $TEST_FS + fi + + if datasetexists $LGCYPOOL ; then + log_must zpool destroy -f $LGCYPOOL + fi + + rm -f $TEST_STREAM +} + +log_onexit cleanup +log_assert "zfs send stream with large dnodes not accepted by legacy pool" + +log_must zfs create -o dnodesize=1k $TEST_FS +log_must touch /$TEST_FS/foo +log_must zfs umount $TEST_FS +log_must zfs snap $TEST_SNAP +log_must eval "zfs send $TEST_SNAP > $TEST_STREAM" + +LGCYPOOL=ldnpool +LGCYFS=$LGCYPOOL/legacy +log_must mkfile 64M $TESTDIR/$LGCYPOOL +log_must zpool create -d $LGCYPOOL $TESTDIR/$LGCYPOOL +log_mustnot eval "zfs recv $LGCYFS < $TEST_STREAM" + +log_pass diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_005_pos.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_005_pos.ksh new file mode 100755 index 000000000000..13f1288e4e8c --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_005_pos.ksh @@ -0,0 +1,75 @@ +#!/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" + +TEST_SEND_FS=$TESTPOOL/send_large_dnode +TEST_RECV_FS=$TESTPOOL/recv_large_dnode +TEST_SNAP=$TEST_SEND_FS@ldnsnap +TEST_SNAPINCR=$TEST_SEND_FS@ldnsnap_incr +TEST_STREAM=$TESTDIR/ldnsnap +TEST_STREAMINCR=$TESTDIR/ldnsnap_incr +TEST_FILE=foo +TEST_FILEINCR=bar + +function cleanup +{ + if datasetexists $TEST_SEND_FS ; then + log_must zfs destroy -r $TEST_SEND_FS + fi + + if datasetexists $TEST_RECV_FS ; then + log_must zfs destroy -r $TEST_RECV_FS + fi + + rm -f $TEST_STREAM + rm -f $TEST_STREAMINCR +} + +log_onexit cleanup + +log_assert "zfs send stream with large dnodes accepted by new pool" + +log_must zfs create -o dnodesize=1k $TEST_SEND_FS +log_must touch /$TEST_SEND_FS/$TEST_FILE +log_must zfs snap $TEST_SNAP +log_must zfs send $TEST_SNAP > $TEST_STREAM +log_must rm -f /$TEST_SEND_FS/$TEST_FILE +log_must touch /$TEST_SEND_FS/$TEST_FILEINCR +log_must zfs snap $TEST_SNAPINCR +log_must zfs send -i $TEST_SNAP $TEST_SNAPINCR > $TEST_STREAMINCR + +log_must eval "zfs recv $TEST_RECV_FS < $TEST_STREAM" +inode=$(ls -li /$TEST_RECV_FS/$TEST_FILE | awk '{print $1}') +dnsize=$(zdb -dddd $TEST_RECV_FS $inode | awk '/ZFS plain file/ {print $6}') +if [[ "$dnsize" != "1K" ]]; then + log_fail "dnode size is $dnsize (expected 1K)" +fi + +log_must eval "zfs recv -F $TEST_RECV_FS < $TEST_STREAMINCR" +log_must diff -r /$TEST_SEND_FS /$TEST_RECV_FS +log_must zfs umount $TEST_SEND_FS +log_must zfs umount $TEST_RECV_FS + +log_pass diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_006_pos.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_006_pos.ksh new file mode 100755 index 000000000000..68fc5e304011 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_006_pos.ksh @@ -0,0 +1,67 @@ +#!/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 +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Copyright (c) 2013, 2016 by Delphix. All rights reserved. +# + +. $STF_SUITE/include/libtest.shlib + +# +# DESCRIPTION: +# Run xattrtest on a dataset with large dnodes and xattr=sa +# to stress xattr usage of the extra bonus space and verify +# contents +# + +TEST_FS=$TESTPOOL/large_dnode + +verify_runnable "both" + +function cleanup +{ + datasetexists $TEST_FS && log_must zfs destroy $TEST_FS +} + +log_onexit cleanup +log_assert "xattrtest runs cleanly on dataset with large dnodes" + +log_must zfs create $TEST_FS + +set -A xattr_sizes "512" "1536" "3584" "7680" "15872" +set -A prop_values "1k" "2k" "4k" "8k" "16k" + +for ((i=0; i < ${#prop_values[*]}; i++)) ; do + prop_val=${prop_values[$i]} + dir=/$TEST_FS/$prop_val + xattr_size=${xattr_sizes[$i]} + log_must zfs set dnsize=$prop_val $TEST_FS + log_must mkdir $dir + log_must xattrtest -R -y -s $xattr_size -f 1024 -p $dir +done + +log_pass diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_007_neg.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_007_neg.ksh new file mode 100755 index 000000000000..fb4747839f3d --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_007_neg.ksh @@ -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 +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Copyright (c) 2013, 2016 by Delphix. All rights reserved. +# + +. $STF_SUITE/include/libtest.shlib + +# +# DESCRIPTION: +# Verify that the dnodesize dataset property won't accept a value +# other than "legacy" if the large_dnode feature is not enabled. +# + +verify_runnable "both" + +function cleanup +{ + if datasetexists $LGCYPOOL ; then + log_must zpool destroy -f $LGCYPOOL + fi +} + +log_onexit cleanup + +log_assert "values other than dnodesize=legacy rejected by legacy pool" + +set -A prop_vals "auto" "1k" "2k" "4k" "8k" "16k" + +LGCYPOOL=lgcypool +LGCYFS=$LGCYPOOL/legacy +log_must mkfile 64M $TESTDIR/$LGCYPOOL +log_must zpool create -d $LGCYPOOL $TESTDIR/$LGCYPOOL +log_must zfs create $LGCYFS + +for val in ${prop_vals[@]} ; do + log_mustnot zfs set dnodesize=$val $LGCYFS +done + +log_pass diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_008_pos.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_008_pos.ksh new file mode 100755 index 000000000000..eac292cbe064 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_008_pos.ksh @@ -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 +# + +# +# Copyright (c) 2017 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + +. $STF_SUITE/include/libtest.shlib + +# +# DESCRIPTION: +# Run many xattrtests on a dataset with large dnodes and xattr=sa to +# stress concurrent allocation of large dnodes. +# + +TEST_FS=$TESTPOOL/large_dnode + +verify_runnable "both" + +function cleanup +{ + datasetexists $TEST_FS && log_must zfs destroy $TEST_FS +} + +function verify_dnode_packing +{ + zdb -dd $TEST_FS | grep -A 3 'Dnode slots' | awk ' + /Total used:/ {total_used=$NF} + /Max used:/ {max_used=$NF} + /Percent empty:/ {print total_used, max_used, int($NF)} + ' | while read total_used max_used pct_empty + do + log_note "total_used $total_used max_used $max_used pct_empty $pct_empty" + if [ $pct_empty -gt 5 ]; then + log_fail "Holes in dnode array: pct empty $pct_empty > 5" + fi + done +} + +log_onexit cleanup +log_assert "xattrtest runs concurrently on dataset with large dnodes" + +log_must zfs create $TEST_FS +log_must zfs set dnsize=auto $TEST_FS +log_must zfs set xattr=sa $TEST_FS + +for ((i=0; i < 100; i++)); do + dir="/$TEST_FS/dir.$i" + log_must mkdir "$dir" + log_must eval "xattrtest -R -r -y -x 1 -f 1024 -k -p $dir >/dev/null 2>&1 &" +done + +log_must wait + +verify_dnode_packing + +log_pass diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_009_pos.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_009_pos.ksh new file mode 100755 index 000000000000..fa746c52e5c5 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_009_pos.ksh @@ -0,0 +1,71 @@ +#!/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 +# + +# +# Copyright (c) 2017 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + +. $STF_SUITE/include/libtest.shlib + +# +# DESCRIPTION: +# Run many xattrtests on a dataset with large dnodes and xattr=sa to +# stress concurrent allocation of large dnodes. +# + +TEST_FS=$TESTPOOL/large_dnode + +verify_runnable "both" + +function cleanup +{ + datasetexists $TEST_FS && log_must zfs destroy $TEST_FS +} + +log_onexit cleanup +log_assert "xattrtest runs concurrently on dataset with large dnodes" + +log_must zfs create $TEST_FS +log_must zfs set dnsize=auto $TEST_FS +log_must zfs set xattr=sa $TEST_FS + +for ((i=0; i < 100; i++)); do + dir="/$TEST_FS/dir.$i" + log_must mkdir "$dir" + + do_unlink="" + if [ $((RANDOM % 2)) -eq 0 ]; then + do_unlink="-k -f 1024" + else + do_unlink="-f $((RANDOM % 1024))" + fi + log_must eval "xattrtest -R -r -y -x 1 $do_unlink -p $dir >/dev/null 2>&1 &" +done + +log_must wait + +log_must zpool export $TESTPOOL +log_must zpool import $TESTPOOL +log_must ls -lR "/$TEST_FS/" >/dev/null 2>&1 +log_must zdb -d $TESTPOOL +log_pass diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/setup.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/setup.ksh new file mode 100755 index 000000000000..d9b1a6ee8594 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/setup.ksh @@ -0,0 +1,27 @@ +#!/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 + +DISK=${DISKS%% *} + +default_setup $DISK diff --git a/usr/src/test/zfs-tests/tests/functional/rsend/rsend.kshlib b/usr/src/test/zfs-tests/tests/functional/rsend/rsend.kshlib index 8f1f30ed267f..5d2ba60f186b 100644 --- a/usr/src/test/zfs-tests/tests/functional/rsend/rsend.kshlib +++ b/usr/src/test/zfs-tests/tests/functional/rsend/rsend.kshlib @@ -208,8 +208,8 @@ function cmp_ds_prop for item in "type" "origin" "volblocksize" "aclinherit" "aclmode" \ "atime" "canmount" "checksum" "compression" "copies" "devices" \ - "exec" "quota" "readonly" "recordsize" "reservation" "setuid" \ - "sharenfs" "snapdir" "version" "volsize" "xattr" "zoned" \ + "dnodesize" "exec" "quota" "readonly" "recordsize" "reservation" \ + "setuid" "sharenfs" "snapdir" "version" "volsize" "xattr" "zoned" \ "mountpoint"; do zfs get -H -o property,value,source $item $dtst1 >> \ diff --git a/usr/src/test/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh b/usr/src/test/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh index af6f49dc25c0..d257ed8e4c29 100644 --- a/usr/src/test/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh @@ -142,6 +142,7 @@ for fs in "$POOL" "$POOL/pclone" "$POOL/$FS" "$POOL/$FS/fs1" \ rand_set_prop $fs exec "on" "off" rand_set_prop $fs quota "512M" "1024M" rand_set_prop $fs recordsize "512" "2K" "8K" "32K" "128K" + rand_set_prop $fs dnodesize "legacy" "auto" "1k" "2k" "4k" "8k" "16k" rand_set_prop $fs setuid "on" "off" rand_set_prop $fs snapdir "hidden" "visible" rand_set_prop $fs xattr "on" "off"