OpenZFS 6404 - zvol_swap_006_pos can occasionally fail due to swaplen being < 16

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
This commit is contained in:
Matthew Ahrens 2016-05-15 08:09:13 -07:00 committed by Brian Behlendorf
parent f9caf08a74
commit 3d3fe9f9bb
9 changed files with 34 additions and 16 deletions

View 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
}
#

View File

@ -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."

View File

@ -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"

View File

@ -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."

View File

@ -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

View File

@ -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."

View File

@ -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,12 +44,15 @@
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"

View File

@ -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"

View File

@ -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