]> granicus.if.org Git - zfs/commitdiff
OpenZFS 6404 - zvol_swap_006_pos can occasionally fail due to swaplen being < 16
authorMatthew Ahrens <mahrens@delphix.com>
Sun, 15 May 2016 15:09:13 +0000 (08:09 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 15 Feb 2017 20:12:48 +0000 (12:12 -0800)
Authored by: Matthew Ahrens <mahrens@delphix.com>
6405 zvol test setup is non deterministic
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: Will Andrews <will@freebsd.org>
Approved by: Dan McDonald <danmcd@omniti.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Ported-by: George Melikov <mail@gmelikov.ru>
OpenZFS-issue: https://www.illumos.org/issues/6404
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/24e268f
Closes #5792

Porting notes:
- Converted zfs to $ZFS until OpenZFS 7290 is ported.
  openzfs/openzfs@1d32ba6

tests/zfs-tests/tests/functional/zvol/zvol_common.shlib
tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_001_neg.ksh
tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_002_pos.ksh
tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_003_neg.ksh
tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_004_pos.ksh
tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_005_neg.ksh
tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_006_pos.ksh
tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_004_pos.ksh
tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_006_pos.ksh

index 30149799ad42c181f78fde37d6136116751f6768..94da0d4b4df0ef5583489dce47bd8f81bdf06b45 100644 (file)
@@ -25,7 +25,7 @@
 #
 
 #
-# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
 #
 
 . $STF_SUITE/include/libtest.shlib
@@ -48,8 +48,6 @@ function default_zvol_setup # disk_device volume_size
 
         log_must $ZFS create -V $size $TESTPOOL/$TESTVOL
        block_device_wait
-
-       set_dumpsize $TESTPOOL/$TESTVOL
 }
 
 #
index 9c474515d5eaf8f0b0e0f6be6c3a1748cbf2258b..eff2745f54bb9b6668bb5aeb0287df3db2588e2a 100755 (executable)
@@ -26,7 +26,7 @@
 #
 
 #
-# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
 #
 
 . $STF_SUITE/include/libtest.shlib
@@ -44,6 +44,8 @@
 
 verify_runnable "global"
 
+volsize=$($ZFS get -H -o value volsize $TESTPOOL/$TESTVOL)
+
 function cleanup
 {
        typeset dumpdev=$(get_dumpdevice)
@@ -51,6 +53,7 @@ function cleanup
        if [[ $dumpdev != $savedumpdev ]] ; then
                safe_dumpadm $savedumpdev
        fi
+       $ZFS set volsize=$volsize $TESTPOOL/$TESTVOL
 }
 
 log_assert "Verify that a ZFS volume can act as dump device."
index 3a5aa9fc437f1f291cbc50f26f373168d4e51bd6..8cf1e87048b85b50e45812bb3f86073ecaefe150 100755 (executable)
@@ -26,7 +26,7 @@
 #
 
 #
-# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
 #
 
 . $STF_SUITE/include/libtest.shlib
@@ -43,6 +43,8 @@
 
 verify_runnable "global"
 
+volsize=$($ZFS get -H -o value volsize $TESTPOOL/$TESTVOL)
+
 function cleanup
 {
        snapexists $TESTPOOL/$TESTVOL@snap && \
@@ -52,6 +54,7 @@ function cleanup
        (( $? == 0 )) && log_must $UMOUNT $TESTDIR
 
        [[ -e $TESTDIR ]] && $RM -rf $TESTDIR
+       $ZFS set volsize=$volsize $TESTPOOL/$TESTVOL
 }
 
 log_assert "Verify that ZFS volume snapshot could be fscked"
@@ -61,6 +64,8 @@ TESTVOL='testvol'
 BLOCKSZ=$(( 1024 * 1024 ))
 NUM_WRITES=40
 
+log_must $ZFS set volsize=128m $TESTPOOL/$TESTVOL
+
 $ECHO "y" | $NEWFS -v ${ZVOL_RDEVDIR}/$TESTPOOL/$TESTVOL >/dev/null 2>&1
 (( $? != 0 )) && log_fail "Unable to newfs(1M) $TESTPOOL/$TESTVOL"
 
index 3fd27002958dc84ab07d7dfec0d2817525116065..1913a75a394e21f2bee3c018164c2a4da6c85717 100755 (executable)
@@ -26,7 +26,7 @@
 #
 
 #
-# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
 #
 
 . $STF_SUITE/include/libtest.shlib
@@ -45,6 +45,8 @@
 
 verify_runnable "global"
 
+volsize=$($ZFS get -H -o value volsize $TESTPOOL/$TESTVOL)
+
 function cleanup
 {
        typeset dumpdev=$(get_dumpdevice)
@@ -55,6 +57,7 @@ function cleanup
        if poolexists $TESTPOOL1 ; then
                destroy_pool $TESTPOOL1
        fi
+       $ZFS set volsize=$volsize $TESTPOOL/$TESTVOL
 }
 
 log_assert "Verify zpool creation and newfs on dump zvol is denied."
index 176379e0328e90eaa6b5eec8f84f90a2370e768c..9a3632aac0738e624a973a0db8566163a41c9a32 100755 (executable)
@@ -26,7 +26,7 @@
 #
 
 #
-# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
 #
 
 . $STF_SUITE/include/libtest.shlib
@@ -44,6 +44,8 @@
 
 verify_runnable "global"
 
+volsize=$($ZFS get -H -o value volsize $TESTPOOL/$TESTVOL)
+
 function cleanup
 {
        typeset dumpdev=$(get_dumpdevice)
@@ -62,6 +64,7 @@ function cleanup
                        log_must $ZFS destroy $TESTPOOL/$TESTVOL@$snap
                fi
        done
+       $ZFS set volsize=$volsize $TESTPOOL/$TESTVOL
 }
 
 function verify_snapshot
index f2cec946ae98e595607e9230493f1e768d763443..a566f9f80655b7f41aeb143d43ade82306ebdbbd 100755 (executable)
@@ -26,7 +26,7 @@
 #
 
 #
-# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
 #
 
 . $STF_SUITE/include/libtest.shlib
@@ -44,6 +44,8 @@
 
 verify_runnable "global"
 
+volsize=$($ZFS get -H -o value volsize $TESTPOOL/$TESTVOL)
+
 function cleanup
 {
        $SWAP -l | $GREP $voldev > /dev/null 2>&1
@@ -55,6 +57,7 @@ function cleanup
        if [[ $dumpdev != $savedumpdev ]] ; then
                safe_dumpadm $savedumpdev
        fi
+       $ZFS set volsize=$volsize $TESTPOOL/$TESTVOL
 }
 
 log_assert "Verify a device cannot be dump and swap at the same time."
index 3b8737f0f112debb1014fa825b433ea0b786e7b0..0298c68939b3d98032879ef51ce6aab090f9d66d 100755 (executable)
@@ -26,7 +26,7 @@
 #
 
 #
-# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
 #
 
 . $STF_SUITE/include/libtest.shlib
 
 verify_runnable "global"
 
+volsize=$(zfs get -H -o value volsize $TESTPOOL/$TESTVOL)
+
 function cleanup
 {
        typeset dumpdev=$(get_dumpdevice)
        if [[ $dumpdev != $savedumpdev ]] ; then
                safe_dumpadm $savedumpdev
        fi
+       zfs set volsize=$volsize $TESTPOOL/$TESTVOL
 }
 
 log_assert "zfs volume as dumpdevice should have 128k volblocksize"
index 94e598dec90ce8702a72e13fce54a14ba8afe61c..5d0eedf814ad394124cb6d39f6445481742cfefd 100755 (executable)
@@ -26,7 +26,7 @@
 #
 
 #
-# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
 #
 
 . $STF_SUITE/include/libtest.shlib
@@ -54,7 +54,7 @@ log_assert "For an added swap zvol, (2G <= volsize <= 16G)"
 
 log_onexit cleanup
 
-for vbs in 512 1024 2048 4096 8192 16384 32768 65536 131072; do
+for vbs in 8192 16384 32768 65536 131072; do
        for multiplier in 1 32 16384 131072; do
                ((volsize = vbs * multiplier))
                vol="$TESTPOOL/vol_$volsize"
index fcbbefc6edfedc09071083ac0ecd8672c3af4fdf..c49d49643028df74def8b7e1cad3aff67d7eee58 100755 (executable)
@@ -26,7 +26,7 @@
 #
 
 #
-# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
 #
 
 . $STF_SUITE/include/libtest.shlib
@@ -75,13 +75,13 @@ log_note "Verify volume can be add as several segments."
 #
 #              swaplow                 swaplen
 set -A swap_opt        $((pageblocks))     \
-               $((pageblocks * ((RANDOM % 50) + 1) + (RANDOM % pageblocks) )) \
+               $((RANDOM % (50 * pageblocks) + 2 * pageblocks)) \
                $((volblocks / 3))  \
-               $((pageblocks * ((RANDOM % 50) + 1) + (RANDOM % pageblocks) )) \
+               $((RANDOM % (50 * pageblocks) + 2 * pageblocks)) \
                $((volblocks / 2))  \
-               $((pageblocks * ((RANDOM % 50) + 1) + (RANDOM % pageblocks) )) \
+               $((RANDOM % (50 * pageblocks) + 2 * pageblocks)) \
                $(((volblocks*2) / 3))  \
-               $((pageblocks * ((RANDOM % 50) + 1) + (RANDOM % pageblocks) ))
+               $((RANDOM % (50 * pageblocks) + 2 * pageblocks))
 
 swapname=${ZVOL_DEVDIR}/$vol
 typeset -i i=0 count=0