diff options
Diffstat (limited to 'usr/src/test/zfs-tests')
25 files changed, 518 insertions, 40 deletions
diff --git a/usr/src/test/zfs-tests/include/libtest.shlib b/usr/src/test/zfs-tests/include/libtest.shlib index 66db2c9501..ed87c46317 100644 --- a/usr/src/test/zfs-tests/include/libtest.shlib +++ b/usr/src/test/zfs-tests/include/libtest.shlib @@ -2625,6 +2625,26 @@ function get_objnum } # +# Sync data to the pool +# +# $1 pool name +# $2 boolean to force uberblock (and config including zpool cache file) update +# +function sync_pool #pool <force> +{ + typeset pool=${1:-$TESTPOOL} + typeset force=${2:-false} + + if [[ $force == true ]]; then + log_must zpool sync -f $pool + else + log_must zpool sync $pool + fi + + return 0 +} + +# # Prints the current time in seconds since UNIX Epoch. # function current_epoch diff --git a/usr/src/test/zfs-tests/runfiles/delphix.run b/usr/src/test/zfs-tests/runfiles/delphix.run index 1f7ce39c8c..ed3961f323 100644 --- a/usr/src/test/zfs-tests/runfiles/delphix.run +++ b/usr/src/test/zfs-tests/runfiles/delphix.run @@ -349,6 +349,9 @@ tests = ['zpool_upgrade_001_pos', 'zpool_upgrade_002_pos', 'zpool_upgrade_006_neg', 'zpool_upgrade_007_pos', 'zpool_upgrade_008_pos', 'zpool_upgrade_009_neg'] +[/opt/zfs-tests/tests/functional/cli_root/zpool_sync] +tests = ['zpool_sync_001_pos', 'zpool_sync_002_neg'] + [/opt/zfs-tests/tests/functional/cli_user/misc] tests = ['zdb_001_neg', 'zfs_001_neg', 'zfs_allow_001_neg', 'zfs_clone_001_neg', 'zfs_create_001_neg', 'zfs_destroy_001_neg', diff --git a/usr/src/test/zfs-tests/runfiles/omnios.run b/usr/src/test/zfs-tests/runfiles/omnios.run index a8bad95433..5847e0e980 100644 --- a/usr/src/test/zfs-tests/runfiles/omnios.run +++ b/usr/src/test/zfs-tests/runfiles/omnios.run @@ -13,6 +13,7 @@ # Copyright (c) 2013, 2017 by Delphix. All rights reserved. # Copyright 2016, OmniTI Computer Consulting, Inc. All rights reserved. # Copyright 2018 Joyent, Inc. +# Copyright 2019 RackTop Systems. # [DEFAULT] @@ -318,6 +319,9 @@ tests = ['zpool_upgrade_001_pos', 'zpool_upgrade_002_pos', 'zpool_upgrade_006_neg', 'zpool_upgrade_007_pos', 'zpool_upgrade_008_pos', 'zpool_upgrade_009_neg'] +[/opt/zfs-tests/tests/functional/cli_root/zpool_sync] +tests = ['zpool_sync_001_pos', 'zpool_sync_002_neg'] + [/opt/zfs-tests/tests/functional/cli_user/misc] tests = ['zdb_001_neg', 'zfs_001_neg', 'zfs_allow_001_neg', 'zfs_clone_001_neg', 'zfs_create_001_neg', 'zfs_destroy_001_neg', @@ -456,8 +460,6 @@ tests = ['checkpoint_after_rewind', 'checkpoint_big_rewind', 'checkpoint_open', 'checkpoint_removal', 'checkpoint_rewind', 'checkpoint_ro_rewind', 'checkpoint_sm_scale', 'checkpoint_twice', 'checkpoint_vdev_add', 'checkpoint_zdb', 'checkpoint_zhack_feat'] -pre = -post = [/opt/zfs-tests/tests/functional/pool_names] tests = ['pool_names_001_pos', 'pool_names_002_neg'] diff --git a/usr/src/test/zfs-tests/runfiles/openindiana.run b/usr/src/test/zfs-tests/runfiles/openindiana.run index fc3131dc76..3c1202f751 100644 --- a/usr/src/test/zfs-tests/runfiles/openindiana.run +++ b/usr/src/test/zfs-tests/runfiles/openindiana.run @@ -13,6 +13,7 @@ # Copyright (c) 2012, 2017 by Delphix. All rights reserved. # Copyright 2016, OmniTI Computer Consulting, Inc. All rights reserved. # Copyright 2018 Joyent, Inc. +# Copyright 2019 RackTop Systems. # [DEFAULT] @@ -318,6 +319,9 @@ tests = ['zpool_upgrade_001_pos', 'zpool_upgrade_002_pos', 'zpool_upgrade_006_neg', 'zpool_upgrade_007_pos', 'zpool_upgrade_008_pos', 'zpool_upgrade_009_neg'] +[/opt/zfs-tests/tests/functional/cli_root/zpool_sync] +tests = ['zpool_sync_001_pos', 'zpool_sync_002_neg'] + [/opt/zfs-tests/tests/functional/cli_user/misc] tests = ['zdb_001_neg', 'zfs_001_neg', 'zfs_allow_001_neg', 'zfs_clone_001_neg', 'zfs_create_001_neg', 'zfs_destroy_001_neg', @@ -456,8 +460,6 @@ tests = ['checkpoint_after_rewind', 'checkpoint_big_rewind', 'checkpoint_open', 'checkpoint_removal', 'checkpoint_rewind', 'checkpoint_ro_rewind', 'checkpoint_sm_scale', 'checkpoint_twice', 'checkpoint_vdev_add', 'checkpoint_zdb', 'checkpoint_zhack_feat'] -pre = -post = [/opt/zfs-tests/tests/functional/pool_names] tests = ['pool_names_001_pos', 'pool_names_002_neg'] diff --git a/usr/src/test/zfs-tests/runfiles/smartos.run b/usr/src/test/zfs-tests/runfiles/smartos.run index 952be3652f..1155c29025 100644 --- a/usr/src/test/zfs-tests/runfiles/smartos.run +++ b/usr/src/test/zfs-tests/runfiles/smartos.run @@ -23,6 +23,10 @@ post_user = root post = cleanup outputdir = /var/tmp/test_results +[/opt/zfs-tests/tests/functional/cli_root/zpool_get] +tests = ['zpool_get_001_pos', 'zpool_get_002_pos', 'zpool_get_003_pos', + 'zpool_get_004_neg'] + [/opt/zfs-tests/tests/functional/cli_root/zpool_import] tests = ['zpool_import_001_pos', 'zpool_import_002_pos', 'zpool_import_003_pos', 'zpool_import_004_pos', 'zpool_import_005_pos', @@ -67,6 +71,9 @@ tests = ['zpool_upgrade_001_pos', 'zpool_upgrade_002_pos', 'zpool_upgrade_006_neg', 'zpool_upgrade_008_pos', 'zpool_upgrade_009_neg'] +[/opt/zfs-tests/tests/functional/cli_root/zpool_sync] +tests = ['zpool_sync_001_pos', 'zpool_sync_002_neg'] + [/opt/zfs-tests/tests/functional/cli_user/misc] tests = ['zdb_001_neg', 'zfs_001_neg', 'zfs_allow_001_neg', 'zfs_clone_001_neg', 'zfs_create_001_neg', 'zfs_destroy_001_neg', @@ -132,6 +139,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'] @@ -214,12 +225,14 @@ tests = ['reservation_001_pos', 'reservation_002_pos', 'reservation_003_pos', tests = ['rootpool_003_neg'] [/opt/zfs-tests/tests/functional/rsend] -tests = ['rsend_001_pos', 'rsend_002_pos', 'rsend_003_pos', 'rsend_006_pos', - 'rsend_007_pos', 'rsend_013_pos', 'rsend_014_pos', +tests = ['rsend_001_pos', 'rsend_002_pos', 'rsend_003_pos', 'rsend_004_pos', + 'rsend_005_pos', 'rsend_006_pos', 'rsend_007_pos', + 'rsend_013_pos', 'rsend_014_pos', 'rsend_019_pos', 'rsend_020_pos', 'rsend_021_pos', 'rsend_022_pos', 'rsend_024_pos', 'send-c_verify_ratio', 'send-c_verify_contents', 'send-c_incremental', + 'send-c_resume', 'send-c_recv_dedup'] [/opt/zfs-tests/tests/functional/slog] diff --git a/usr/src/test/zfs-tests/tests/functional/clean_mirror/clean_mirror_common.kshlib b/usr/src/test/zfs-tests/tests/functional/clean_mirror/clean_mirror_common.kshlib index e88f6c4431..efe706fbb0 100644 --- a/usr/src/test/zfs-tests/tests/functional/clean_mirror/clean_mirror_common.kshlib +++ b/usr/src/test/zfs-tests/tests/functional/clean_mirror/clean_mirror_common.kshlib @@ -26,8 +26,10 @@ # # Copyright (c) 2013, 2016 by Delphix. All rights reserved. +# Copyright (c) 2017 Datto Inc. # +. $STF_SUITE/include/libtest.shlib . $STF_SUITE/tests/functional/clean_mirror/default.cfg # Most of the code related to the clearing of mirrors is duplicated in all @@ -36,32 +38,6 @@ # the contents of the mirror. # This code is sourced into each of these test cases. -# -# Synchronize all the data in pool -# -# $1 pool name -# -function sync_pool #pool -{ - typeset pool=$1 - - log_must sync - log_must sleep 2 - # Flush all the pool data. - typeset -i ret - zpool scrub $pool >/dev/null 2>&1 - ret=$? - (( $ret != 0 )) && \ - log_fail "zpool scrub $pool failed." - - while ! is_pool_scrubbed $pool; do - if is_pool_resilvered $pool ; then - log_fail "$pool should not be resilver completed." - fi - log_must sleep 2 - done -} - function overwrite_verify_mirror { typeset AFFECTED_DEVICE=$1 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 76b7a1582b..ebf4e77ba8 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 @@ -54,6 +54,8 @@ typeset -a properties=( "freeing" "fragmentation" "leaked" + "bootsize" + "checkpoint" "feature@async_destroy" "feature@empty_bpobj" "feature@lz4_compress" @@ -66,9 +68,12 @@ typeset -a properties=( "feature@bookmarks" "feature@filesystem_limits" "feature@large_blocks" + "feature@large_dnode" "feature@sha512" "feature@skein" "feature@edonr" "feature@device_removal" - "feature@large_dnode" + "feature@obsolete_counts" + "feature@zpool_checkpoint" + "feature@spacemap_v2" ) diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/Makefile b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/Makefile new file mode 100644 index 0000000000..4208e553b0 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/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 2019 Joyent, Inc. +# + +include $(SRC)/Makefile.master + +ROOTOPTPKG = $(ROOT)/opt/zfs-tests +TARGETDIR = $(ROOTOPTPKG)/tests/functional/cli_root/zpool_sync + +include $(SRC)/test/zfs-tests/Makefile.com diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/cleanup.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/cleanup.ksh new file mode 100755 index 0000000000..89c146249e --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/cleanup.ksh @@ -0,0 +1,32 @@ +#!/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. +# + +. $STF_SUITE/include/libtest.shlib + +verify_runnable "global" + +default_cleanup diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/setup.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/setup.ksh new file mode 100755 index 0000000000..181e62b113 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/setup.ksh @@ -0,0 +1,34 @@ +#!/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. +# + +. $STF_SUITE/include/libtest.shlib + +verify_runnable "global" + +DISK=${DISKS%% *} + +default_setup $DISK diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/zpool_sync_001_pos.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/zpool_sync_001_pos.ksh new file mode 100755 index 0000000000..e72ca2157f --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/zpool_sync_001_pos.ksh @@ -0,0 +1,88 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# 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. +# +# CDDL HEADER END +# +# Copyright (c) 2017 Datto Inc. +# + +. $STF_SUITE/include/libtest.shlib + +# +# DESCRIPTION: +# Verify 'zpool sync' can sync txgs to the pool(s) main vdevs. +# +# STRATEGY: +# 1. Create a pool +# 2. Use zdb to obtain current txg +# 3. Create a file in the pool if we're not using force sync +# 4. Use zpool sync to sync pool +# 5. Verify the new txg is now bigger than the saved one +# + +verify_runnable "global" + +function get_txg { + typeset -i txg=$(zdb -u $1 | sed -n 's/^[ ][ ]*txg = \(.*\)$/\1/p') + echo $txg +} + +set -A args "sync $TESTPOOL" "sync -f $TESTPOOL" "sync" "sync -f" + +log_assert "Verify 'zpool sync' can sync a pool" + +typeset -i i=0 +typeset -i orig_txg=0 +typeset -i new_txg=0 +while [[ $i -lt ${#args[*]} ]]; do + orig_txg=$(get_txg $TESTPOOL) + if ! [[ "${args[i]}" =~ "-f" ]]; then + log_must touch /$TESTPOOL/$i + fi + log_must zpool ${args[i]} + new_txg=$(get_txg $TESTPOOL) + if [[ $orig_txg -ge $new_txg ]]; then + log_fail "'zpool ${args[i]}' failed: txg $orig_txg >= $new_txg" + fi + ((i = i + 1)) +done + +# sync_pool is implemented using 'zpool sync' so let's test it as well + +# make sure we can use sync_pool with force sync explicitly not used +orig_txg=$(get_txg $TESTPOOL) +log_must touch /$TESTPOOL/$i +log_must sync_pool $TESTPOOL false +new_txg=$(get_txg $TESTPOOL) +if [[ $orig_txg -ge $new_txg ]]; then + log_fail "'sync_pool $TESTPOOL false' failed: txg $orig_txg >= $new_txg" +fi + +# make sure we can use sync_pool with force sync explicitly enabled +orig_txg=$(get_txg $TESTPOOL) +log_must sync_pool $TESTPOOL true +new_txg=$(get_txg $TESTPOOL) +if [[ $orig_txg -ge $new_txg ]]; then + log_fail "'sync_pool $TESTPOOL true' failed: txg $orig_txg >= $new_txg" +fi + +# make sure we can use sync_pool with force sync implicitly not used +orig_txg=$(get_txg $TESTPOOL) +log_must touch /$TESTPOOL/$i +log_must sync_pool $TESTPOOL +new_txg=$(get_txg $TESTPOOL) +if [[ $orig_txg -ge $new_txg ]]; then + log_fail "'sync_pool $TESTPOOL' failed: txg $orig_txg >= $new_txg" +fi + +log_pass "'zpool sync' syncs pool as expected." diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/zpool_sync_002_neg.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/zpool_sync_002_neg.ksh new file mode 100755 index 0000000000..e35a29130c --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_sync/zpool_sync_002_neg.ksh @@ -0,0 +1,44 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# 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. +# +# CDDL HEADER END +# +# Copyright (c) 2017 Datto Inc. +# + +. $STF_SUITE/include/libtest.shlib + +# +# DESCRIPTION: +# A badly formed parameter passed to 'zpool sync' should +# return an error. +# +# STRATEGY: +# 1. Create an array containing bad 'zpool sync' parameters. +# 2. For each element, execute the sub-command. +# 3. Verify it returns an error. +# + +verify_runnable "global" + +set -A args "1" "-a" "-?" "--%" "-123456" "0.5" "-o" "-b" "-b no" "-z 2" + +log_assert "Execute 'zpool sync' using invalid parameters." + +typeset -i i=0 +while [[ $i -lt ${#args[*]} ]]; do + log_mustnot zpool sync ${args[i]} + ((i = i + 1)) +done + +log_pass "Invalid parameters to 'zpool sync' fail as expected." 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 index 61caf39100..60e481d998 100755 --- a/usr/src/test/zfs-tests/tests/functional/large_dnode/cleanup.ksh +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/cleanup.ksh @@ -20,6 +20,11 @@ # CDDL HEADER END # +# +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + . $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 index c07f4e8d74..d3530292e8 100755 --- 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 @@ -20,6 +20,11 @@ # CDDL HEADER END # +# +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + . $STF_SUITE/include/libtest.shlib # 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 index 1dd8d888c3..c2b32ad662 100755 --- 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 @@ -20,6 +20,11 @@ # CDDL HEADER END # +# +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + . $STF_SUITE/include/libtest.shlib # 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 index a938c7de7c..20989e1d77 100755 --- 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 @@ -20,6 +20,11 @@ # CDDL HEADER END # +# +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + . $STF_SUITE/include/libtest.shlib verify_runnable "both" 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 index 1006ae6af5..3fa1cabe06 100755 --- 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 @@ -21,6 +21,11 @@ # # +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + +# # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # 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 index 13f1288e4e..a2d92673b1 100755 --- 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 @@ -20,6 +20,11 @@ # CDDL HEADER END # +# +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + . $STF_SUITE/include/libtest.shlib verify_runnable "both" 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 index 68fc5e3040..38b4ac52e5 100755 --- 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 @@ -21,6 +21,11 @@ # # +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + +# # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # 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 index fb4747839f..59364574b1 100755 --- 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 @@ -21,6 +21,11 @@ # # +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + +# # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # 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 index d9b1a6ee85..a9425cca98 100755 --- a/usr/src/test/zfs-tests/tests/functional/large_dnode/setup.ksh +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/setup.ksh @@ -20,6 +20,11 @@ # CDDL HEADER END # +# +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + . $STF_SUITE/include/libtest.shlib DISK=${DISKS%% *} diff --git a/usr/src/test/zfs-tests/tests/functional/rsend/send_freeobjects.ksh b/usr/src/test/zfs-tests/tests/functional/rsend/send_freeobjects.ksh new file mode 100755 index 0000000000..6533352a9a --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/rsend/send_freeobjects.ksh @@ -0,0 +1,81 @@ +#!/bin/ksh + +# +# 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) 2017 by Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/rsend/rsend.kshlib + +# +# Description: +# Verify FREEOBJECTS record frees sequential objects (See +# https://github.com/zfsonlinux/zfs/issues/6694) +# +# Strategy: +# 1. Create three files with sequential object numbers, f1 f2 and f3 +# 2. Delete f2 +# 3. Take snapshot A +# 4. Delete f3 +# 5. Take snapshot B +# 6. Receive a full send of A +# 7. Receive an incremental send of B +# 8. Fail test if f3 exists on received snapshot B +# + +verify_runnable "both" + +log_assert "Verify FREEOBJECTS record frees sequential objects" + +sendds=sendfo +recvds=recvfo +f1=/$POOL/$sendds/f1 +f2=/$POOL/$sendds/f2 +f3=/$POOL/$sendds/f3 + +# +# We need to set xattr=sa and dnodesize=legacy to guarantee sequential +# object numbers for this test. Otherwise, if we used directory-based +# xattrs, SELinux extended attributes might consume intervening object +# numbers. +# +log_must zfs create -o xattr=sa -o dnodesize=legacy $POOL/$sendds + +tries=100 +for ((i=0; i<$tries; i++)); do + touch $f1 $f2 $f3 + o1=$(ls -li $f1 | awk '{print $1}') + o2=$(ls -li $f2 | awk '{print $1}') + o3=$(ls -li $f3 | awk '{print $1}') + + if [[ $o2 -ne $(( $o1 + 1 )) ]] || [[ $o3 -ne $(( $o2 + 1 )) ]]; then + rm -f $f1 $f2 $f3 + else + break + fi +done + +if [[ $i -eq $tries ]]; then + log_fail "Failed to create three sequential objects" +fi + +log_must rm $f2 +log_must zfs snap $POOL/$sendds@A +log_must rm $f3 +log_must zfs snap $POOL/$sendds@B +log_must eval "zfs send $POOL/$sendds@A | zfs recv $POOL/$recvds" +log_must eval "zfs send -i $POOL/$sendds@A $POOL/$sendds@B |" \ + "zfs recv $POOL/$recvds" +log_mustnot zdb $POOL/$recvds@B $o3 +log_pass "Verify FREEOBJECTS record frees sequential objects" diff --git a/usr/src/test/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh b/usr/src/test/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh new file mode 100755 index 0000000000..12a72fa092 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh @@ -0,0 +1,111 @@ +#!/bin/ksh + +# +# 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) 2017 by Lawrence Livermore National Security, LLC. +# Copyright (c) 2018 Datto Inc. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/rsend/rsend.kshlib + +# +# Description: +# Verify incremental receive properly handles objects with changed +# dnode slot count. +# +# Strategy: +# 1. Populate a dataset with 1k byte dnodes and snapshot +# 2. Remove objects, set dnodesize=legacy, and remount dataset so new objects +# get recycled numbers and formerly "interior" dnode slots get assigned +# to new objects +# 3. Remove objects, set dnodesize=2k, and remount dataset so new objects +# overlap with recently recycled and formerly "normal" dnode slots get +# assigned to new objects +# 4. Create an empty file and add xattrs to it to exercise reclaiming a +# dnode that requires more than 1 slot for its bonus buffer (Zol #7433) +# 5. Generate initial and incremental streams +# 6. Verify initial and incremental streams can be received +# + +verify_runnable "both" + +log_assert "Verify incremental receive handles objects with changed dnode size" + +function cleanup +{ + rm -f $BACKDIR/fs-dn-legacy + rm -f $BACKDIR/fs-dn-1k + rm -f $BACKDIR/fs-dn-2k + rm -f $BACKDIR/fs-attr + + if datasetexists $POOL/fs ; then + log_must zfs destroy -rR $POOL/fs + fi + + if datasetexists $POOL/newfs ; then + log_must zfs destroy -rR $POOL/newfs + fi +} + +log_onexit cleanup + +# 1. Populate a dataset with 1k byte dnodes and snapshot +log_must zfs create -o dnodesize=1k $POOL/fs +log_must mk_files 200 262144 0 $POOL/fs +log_must zfs snapshot $POOL/fs@a + +# 2. Remove objects, set dnodesize=legacy, and remount dataset so new objects +# get recycled numbers and formerly "interior" dnode slots get assigned +# to new objects +rm /$POOL/fs/* + +log_must zfs unmount $POOL/fs +log_must zfs set dnodesize=legacy $POOL/fs +log_must zfs mount $POOL/fs + +log_must mk_files 200 262144 0 $POOL/fs +log_must zfs snapshot $POOL/fs@b + +# 3. Remove objects, set dnodesize=2k, and remount dataset so new objects +# overlap with recently recycled and formerly "normal" dnode slots get +# assigned to new objects +rm /$POOL/fs/* + +log_must zfs unmount $POOL/fs +log_must zfs set dnodesize=2k $POOL/fs +log_must zfs mount $POOL/fs + +log_must touch /$POOL/fs/attrs +mk_files 200 262144 0 $POOL/fs +log_must zfs snapshot $POOL/fs@c + +# 4. Create an empty file and add xattrs to it to exercise reclaiming a +# dnode that requires more than 1 slot for its bonus buffer (Zol #7433) +log_must zfs set compression=on xattr=sa $POOL/fs +log_must eval "python -c 'print \"a\" * 512' | attr -s bigval /$POOL/fs/attrs" +log_must zfs snapshot $POOL/fs@d + +# 5. Generate initial and incremental streams +log_must eval "zfs send $POOL/fs@a > $BACKDIR/fs-dn-1k" +log_must eval "zfs send -i $POOL/fs@a $POOL/fs@b > $BACKDIR/fs-dn-legacy" +log_must eval "zfs send -i $POOL/fs@b $POOL/fs@c > $BACKDIR/fs-dn-2k" +log_must eval "zfs send -i $POOL/fs@c $POOL/fs@d > $BACKDIR/fs-attr" + +# 6. Verify initial and incremental streams can be received +log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-dn-1k" +log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-dn-legacy" +log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-dn-2k" +log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-attr" + +log_pass "Verify incremental receive handles objects with changed dnode size" diff --git a/usr/src/test/zfs-tests/tests/functional/slog/slog_014_pos.ksh b/usr/src/test/zfs-tests/tests/functional/slog/slog_014_pos.ksh index 02e99fac45..9a2580d554 100644 --- a/usr/src/test/zfs-tests/tests/functional/slog/slog_014_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/slog/slog_014_pos.ksh @@ -28,6 +28,7 @@ # # Copyright (c) 2013, 2018 by Delphix. All rights reserved. # Copyright 2019 Joyent, Inc. +# Copyright 2019 RackTop Systems. # . $STF_SUITE/tests/functional/slog/slog.kshlib diff --git a/usr/src/test/zfs-tests/tests/functional/snapshot/deadlist_lock.ksh b/usr/src/test/zfs-tests/tests/functional/snapshot/deadlist_lock.ksh index 47f912dc9c..a592916a61 100644 --- a/usr/src/test/zfs-tests/tests/functional/snapshot/deadlist_lock.ksh +++ b/usr/src/test/zfs-tests/tests/functional/snapshot/deadlist_lock.ksh @@ -13,6 +13,7 @@ # # Copyright (c) 2016 by Delphix. All rights reserved. +# Copyright 2019 Joyent, Inc. # . $STF_SUITE/include/libtest.shlib @@ -43,15 +44,15 @@ # snapshot right after you create a new test file. # 2. Start DTrace in the background to put a delay in the # sync thread after it closes the empty bpobj and before -# it reopens it. +# it reopens it. The dtrace process is set to exit when this +# script exits. # 3. Start a process in the backgroud that runs zfs-destroy # dry-runs in an infinite loop. The idea is to keep calling # dsl_deadlist_space_range(). # 4. Go ahead and start removing the test files. This should # start populating the deadlist of each snapshot with # entries and go through the dle_enqueue() target code. -# 5. If the test passes, kill the process running on a loop -# and dtrace, and cleanup the dataset. +# 5. Kill the 'zfs destroy' loop and clean up the dataset. # verify_runnable "both" @@ -61,7 +62,7 @@ DLDS="dl_race" function cleanup { - log_must kill -9 $DLOOP_PID $DTRACE_PID + log_must kill -9 $DLOOP_PID log_must zfs destroy -fR $TESTPOOL/$TESTFS/$DLDS } @@ -86,8 +87,7 @@ log_onexit cleanup setup log_must sync -log_must dtrace -qwn "fbt::bpobj_decr_empty:entry { chill(500000000); }" & -DTRACE_PID="$!" +log_must dtrace -p "$PPID" -qwn "fbt::bpobj_decr_empty:entry { chill(500000000); }" & sleep 1 destroy_nv_loop & @@ -100,5 +100,5 @@ done log_must sync log_pass "There should be no race condition when an administrative command" \ - " attempts to read a deadlist's entries at the same time a that a sync" \ + " attempts to read a deadlist's entries while a sync" \ " thread is manipulating it." |