Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/cleanup.ksh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/cleanup.ksh (revision 328576) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/cleanup.ksh (revision 328577) @@ -1,38 +1,39 @@ #!/usr/local/bin/ksh93 -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. # # ident "@(#)cleanup.ksh 1.2 07/01/09 SMI" # # $FreeBSD$ . ${STF_SUITE}/include/libtest.kshlib +. ${STF_SUITE}/include/libgnop.kshlib -verify_runnable "global" - # Rotate logs now, because this test can generate a great volume of log entries newsyslog -default_cleanup +default_cleanup_noexit +destroy_gnops ${DISKS} +log_pass Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/setup.ksh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/setup.ksh (revision 328576) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/setup.ksh (revision 328577) @@ -1,48 +1,39 @@ #!/usr/local/bin/ksh93 -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 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "@(#)setup.ksh 1.3 09/05/19 SMI" # # $FreeBSD$ . ${STF_SUITE}/include/libtest.kshlib -. ${STF_SUITE}/include/libsas.kshlib +. $STF_SUITE/include/libgnop.kshlib -verify_runnable "global" -echo "list of disks: $DISKS" - -# Make sure that all of the disks that we've been given are attached to a -# SAS expander, and that we can find the phy they're attached to. This -# function will cause the script to exit if it fails. -for disk in $DISKS -do - find_verify_sas_disk $disk -done +log_must create_gnops ${DISKS} # Rotate logs now, because this test can generate a great volume of log entries newsyslog log_pass Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash.cfg =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash.cfg (revision 328576) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash.cfg (revision 328577) @@ -1,33 +1,32 @@ # # Copyright (c) 2010 Spectra Logic Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions, and the following disclaimer, # without modification. # 2. Redistributions in binary form must reproduce at minimum a disclaimer # substantially similar to the "NO WARRANTY" disclaimer below # ("Disclaimer") and any redistribution must be conditioned upon # including a substantially similar Disclaimer requirement for further # binary redistribution. # # NO WARRANTY # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGES. # # $FreeBSD$ # -export SAS_DEFAULT_TIME=360 -export STF_TIMEOUT=900 +export RUNTIME=180 Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_001_pos.ksh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_001_pos.ksh (revision 328576) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_001_pos.ksh (revision 328577) @@ -1,168 +1,112 @@ #!/usr/local/bin/ksh93 # # Copyright (c) 2010 Spectra Logic Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions, and the following disclaimer, # without modification. # 2. Redistributions in binary form must reproduce at minimum a disclaimer # substantially similar to the "NO WARRANTY" disclaimer below # ("Disclaimer") and any redistribution must be conditioned upon # including a substantially similar Disclaimer requirement for further # binary redistribution. # # NO WARRANTY # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGES. # # $FreeBSD$ # . $STF_SUITE/include/libtest.kshlib -. $STF_SUITE/include/libsas.kshlib +. $STF_SUITE/include/libgnop.kshlib - -typeset -i NUM_FAILURES=0 -export NUM_FAILURES - -# Cleanup function. Kill each of the children, they will re-enable the PHY -# they're working on. +# Cleanup function. Kill each of the children. function docleanup { for CPID in $CHILDREN do echo "Killing $CPID" kill $CPID done for CPID in $CHILDREN do wait $CPID done } -# If we get killed, try to re-enable the PHY we were toggling. -function diskcleanup +function childcleanup { - log_note "Got a signal, sending linkreset to $EXPANDER phy $PHY" - camcontrol smppc $EXPANDER -o linkreset -p $PHY exit 0 } # Wait for the timeout, and then kill the child processes. -function disktimeout +function childrentimeout { - log_note "disktimeout process waiting $1 seconds" + log_note "childrentimeout process waiting $1 seconds" sleep $1 docleanup } function mk_vols { ADISKS=($DISKS) #Create an array for convenience N_DISKS=${#ADISKS[@]} N_MIRRORS=$(($N_DISKS / 2 )) - setup_mirrors $N_MIRRORS $DISKS + # Use a special ksh93 expansion to generate the list of gnop devices + GNOPS=${DISKS//~(E)([[:space:]]+|$)/.nop\1} + setup_mirrors $N_MIRRORS $GNOPS for pool in `all_pools`; do # Create 4 ZVols per pool. Write a geom label to each, just so # that we have another geom class between zvol and the vdev # taster. That thwarts detection of zvols based on a geom - # producer's class name, as was attempted by change 538882 + # producer's class name, as was attempted by Perforce change + # 538882 for ((j=0; $j<4; j=$j+1)); do $ZFS create -V 10G $pool/testvol.$j glabel label testlabel$j /dev/zvol/$pool/testvol.$j done done } export CHILDREN="" -export FAILFILES="" -export POOLS="" log_onexit docleanup -typeset i=0 -typeset -i num_disks_used=0 - -log_assert "Cause frequent device removal and arrival in the prescence of zvols. ZFS should not misbehave while tasting them for VDev GUIDs." +log_assert "Cause frequent device removal and arrival in the prescence of zvols. ZFS should not crash or hang while tasting them for VDev GUIDs." mk_vols for p in `all_pools` do - disk=`get_disklist $p | cut -d " " -f 1` #Take the first disk in the pool - # See if this disk is attached to a parent that supports SMP - # XXX this only works with the current scheme where SMP commands get - # sent to a device or its parent, if the device doesn't support SMP - camcontrol smprg $disk > /dev/null 2>&1 - if [ $? != 0 ]; then - continue - fi + #Take the first gnop in the pool + typeset gnop + typeset disk + gnop=`get_disklist $p | cut -d " " -f 1` + disk=${gnop%.nop} - # Find the expander and PHY that this disk is attached to, if any. - # We will exit from here if there is a failure. - find_verify_sas_disk $disk - - typeset -i x=0 - log_note "thrashing phy on $disk on $EXPANDER phy $PHY" - export FAILFILE=$TMPDIR/${EXPANDER}.${PHY}.failed - trap diskcleanup INT TERM && rm -f $FAILFILE && while `true`; do - ((x=x+1)) - camcontrol smppc $EXPANDER -v -o disable -p $PHY - if [ $? != 0 ]; then - log_note "Failed to disable $EXPANDER phy $PHY" - echo "Expander $EXPANDER phy $PHY failed" >> $FAILFILE - break - fi - $SLEEP 10 - camcontrol smppc $EXPANDER -v -o linkreset -p $PHY - if [ $? != 0 ]; then - log_note "Failed to reset $EXPANDER phy $PHY" - echo "Expander $EXPANDER phy $PHY failed" >> $FAILFILE - break - fi - $SLEEP 10 + log_note "thrashing $gnop" + trap childcleanup INT TERM && while `true`; do + log_must destroy_gnop $disk + $SLEEP 5 + log_must create_gnop $disk + $SLEEP 5 done & CHILDREN="$CHILDREN $!" - FAILFILES="$FAILFILES $FAILFILE" - ((num_disks_used++)) done -typeset -i sleep_time=$SAS_DEFAULT_TIME +log_note "Waiting $RUNTIME seconds for potential ZFS failure" +childrentimeout $RUNTIME -if [ $num_disks_used -gt 0 ]; then - log_note "Tests queued on $num_disks_used disks" - log_note "Waiting $sleep_time seconds for potential driver failure" - disktimeout $sleep_time & - wait - - for i in $FAILFILES; do - typeset FILEBASE=${i%%.failed} - FILEBASE=${FILEBASE##$TMPDIR/} - if [ -f $i ]; then - log_note "Test of $FILEBASE failed" - ((NUM_FAILURES=NUM_FAILURES+1)) - rm -f $i - else - log_note "Test of $FILEBASE passed" - fi - done - if [ $NUM_FAILURES -gt 0 ]; then - log_fail "Saw $NUM_FAILURES failures" - else - log_note "Number of failures: $NUM_FAILURES" - log_pass - fi -else - log_unsupported "No tests queued, no SMP-capable devices found" -fi +log_pass Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_test.sh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_test.sh (revision 328576) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/zvol_thrash/zvol_thrash_test.sh (revision 328577) @@ -1,55 +1,55 @@ # 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 2012 Spectra Logic. All rights reserved. # Use is subject to license terms. # atf_test_case zvol_thrash_001_pos cleanup zvol_thrash_001_pos_head() { atf_set "descr" "Cause frequent device removal and arrival in the prescence of zvols. ZFS should not misbehave while tasting them for VDev GUIDs." - atf_set "require.progs" zfs zpool camcontrol + atf_set "require.progs" zfs zpool gnop atf_set "timeout" 900 } zvol_thrash_001_pos_body() { . $(atf_get_srcdir)/../../include/default.cfg . $(atf_get_srcdir)/zvol_thrash.cfg ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/zvol_thrash_001_pos.ksh || atf_fail "Testcase failed" } zvol_thrash_001_pos_cleanup() { . $(atf_get_srcdir)/../../include/default.cfg . $(atf_get_srcdir)/zvol_thrash.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_init_test_cases() { atf_add_test_case zvol_thrash_001_pos }