Rewrote test 068, test to to reproduce xfs_freeze hang under filsystem load.
authorAndrew Jones <ajones@sgi.com>
Wed, 9 Feb 2005 02:49:23 +0000 (02:49 +0000)
committerAndrew Jones <ajones@sgi.com>
Wed, 9 Feb 2005 02:49:23 +0000 (02:49 +0000)
Merge of master-melb:xfs-cmds:21434a by kenmcd.

  Rewrote test 068. Test case to reproduce xfs_freeze hang under filsystem load.

068
068.out
new

diff --git a/068 b/068
index c23c010ad0609dfccf768c9465d9ecbaba095821..83441275071b715419f7f2405cf35cef3d5e5441 100755 (executable)
--- a/068
+++ b/068
@@ -1,99 +1,49 @@
 #! /bin/sh
 #! /bin/sh
-# FS QA Test No. 068
+# FSQA Test No. 068
 #
 #
-# Test Linux LVM snapshot creation
-#
-# The timing and placement of kills and waits is particularily sensitive.
-# Don't change them unless you want to spend some time getting it right again.
+# Test case to reproduce xfs_freeze hang under filsystem load.
+# The fail case for this test is a hang on an xfs_freeze.
 #
 #-----------------------------------------------------------------------
 #
 #-----------------------------------------------------------------------
-# Copyright (c) 2000, 2002 Silicon Graphics, Inc.  All Rights Reserved.
-# 
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it would be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# 
-# Further, this software is distributed without any warranty that it is
-# free of the rightful claim of any third person regarding infringement
-# or the like.  Any license provided herein, whether implied or
-# otherwise, applies only to this software file.  Patent licenses, if
-# any, provided herein do not apply to combinations of this program with
-# other software, or any other product whatsoever.
-# 
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston MA 02111-1307, USA.
-# 
-# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
-# Mountain View, CA  94043, or:
-# 
-# http://www.sgi.com 
-# 
-# For further information regarding this notice, see: 
-# 
-# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+#  Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+#  USA
+#
+#  Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
+#  Mountain View, CA 94043, USA, or: http://www.sgi.com
 #-----------------------------------------------------------------------
 #
 # creator
 #-----------------------------------------------------------------------
 #
 # creator
-owner=freemyer@NorcrossGroup.com
+owner=ajones@sgi.com
 
 seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
 tmp=/tmp/$$
 
 seq=`basename $0`
 echo "QA output created by $seq"
 
 here=`pwd`
 tmp=/tmp/$$
-mkdir "$tmp"
-status=1       # failure is the default!
-
-# Either "dd" or "fsstress" can be used to generate io load.
-# Setting both to "FALSE" tests with no io load.
-GENERATE_IO_LOAD_VIA_DD=TRUE
-GENERATE_IO_LOAD_VIA_FSSTRESS=TRUE
-DELAY_BETWEEN_ITERATIONS=10
-#ITERATIONS=10000
-ITERATIONS=2
-
-VG=/dev/VGscratch
-SCRATCH_SNAP_MNT="$tmp/scratch_snap"
+status=0       # success is the default!
 
 
-# Only needed if running by hand,  ie.  check sets these
-#SCRATCH_LVM_DEV=/dev/xxxx
-#SCRATCH_MNT=/scratch
+ITERATIONS=10
 
 _cleanup()
 {
 
 _cleanup()
 {
-       echo Cleanup beginning
-
-       rm "$tmp/running"
-       xfs_freeze -u "$SCRATCH_MNT"
-
-       sleep 10      # Give the dd loop time to finish
-
-       # Comment out unless needed.
-       # If needed, wrap with logic to ensure the FS is mounted.
-       # Kill off any other possible stray stragglers that may be out there.
-       # There should not be any.
-       #fuser -k -m "$SCRATCH_SNAP_MNT/dummy"     >/dev/null 2>&1
-       #fuser -k -m "$SCRATCH_MNT/dummy"         >/dev/null 2>&1
-
-       wait
-
-       umount "$SCRATCH_SNAP_MNT" > /dev/null 2>&1
-       rmdir "$SCRATCH_SNAP_MNT" > /dev/null 2>&1
-       umount "$SCRATCH_MNT" > /dev/null 2>&1
+    cd /
+    _cleanup_testdir
 
 
-       lvremove -f "$VG/scratch_snap" > /dev/null 2>&1
-       lvremove -f "$VG/scratch" > /dev/null 2>&1
-
-#TODO   vgremove "$VG"
-
-       rm -rf "$tmp"   # if we ever use tmp files
-       trap 0 1 2 3 15
-       exit $status
+    trap 0 1 2 3 15
+    exit $status
 }
 
 trap "_cleanup" 0 1 2 3 15
 }
 
 trap "_cleanup" 0 1 2 3 15
@@ -105,162 +55,71 @@ trap "_cleanup" 0 1 2 3 15
 
 # real QA test starts here
 _supported_fs xfs
 
 # real QA test starts here
 _supported_fs xfs
-_supported_os Linux
-
-if [ -e "$SCRATCH_SNAP_MNT" ]; then
-       rmdir "$SCRATCH_SNAP_MNT" || _notrun "Cannot rmdir $SCRATCH_SNAP_MNT"
-fi
-mkdir "$SCRATCH_SNAP_MNT"
-
-#Verify we have the lvm user tools
-[ -x /sbin/lvcreate ] || _notrun "lvcreate utility is not installed in /sbin"
-[ -x /sbin/lvremove ] || _notrun "lvremove utility is not installed in /sbin"
-
-# If the above fails for LVM 2, the below may be useful notes
-#    try "lvm vgdisplay --version" and look for a > 1.9x version number, eg,
-# 
-#     LVM version:     1.95.10-cvs (2002-05-31)
-#     Library version: 0.96.03-ioctl-cvs (2002-06-27)
-#     Driver version:  1.0.3
-
-
-LVM=false
-
-# Check if LVM 1 is in the kernel
-if grep lvm /proc/devices > /dev/null; then LVM=true; fi
-
-# Check if LVM 2 is in the kernel
-if grep device-mapper /proc/devices > /dev/null; then LVM=true; fi
-
-# Check if EVMS is in the kernel
-#TODO   # I don't know how to do this one.
-
-[ "$LVM" = false ] && _notrun "LVM is not present in the running kernel."
+_supported_os Linux IRIX
 
 
+_require_scratch
 
 
-# Create a PV set from the scratch partition
-#TODO # (I don't know if this is needed.and it is dangerous because it intentionally deletes the partition table!!! 
-#TODO # dd if=/dev/zero of="$SCRATCH_LVM_DEV" bs=512 count=1
-#TODO # pvcreate "$SCRATCH_LVM_DEV"
+echo "*** init FS"
 
 
-# Create a VG from the PV
-#TODO # vgcreate "$VG" "$SCRATCH_LVM_DEV"
+rm -f $seq.full
+umount $SCRATCH_DEV >/dev/null 2>&1
+echo "*** MKFS ***"                         >>$seq.full
+echo ""                                     >>$seq.full
+_scratch_mkfs_xfs                           >>$seq.full 2>&1 \
+    || _fail "mkfs failed"
+_scratch_mount                              >>$seq.full 2>&1 \
+    || _fail "mount failed"
 
 
-# Create a LV in the VG to snapshot
-#TODO # lvcreate -L 2G -n scratch "$VG"
+touch $tmp.running
 
 
-# Mount the LV
-mkdir "$SCRATCH_MNT"
 
 
-mount "$VG/scratch" "$SCRATCH_MNT"
-
-touch "$tmp/running"
-
-if [ "$GENERATE_IO_LOAD_VIA_DD" != FALSE ]
-then
-       # Create a large 64 Meg zero filled file on the LV
-       dd if=/dev/zero of=$SCRATCH_MNT/dummy bs=64k count=1000 >/dev/null 2>&1
-
-       # Setup infinite loop copying the large file, thus generating heavy I/O
-       touch "$tmp/running"
-       while [ -f "$tmp/running" ]
-       do
-               dd if="$SCRATCH_MNT/dummy" of="$SCRATCH_MNT/junk" bs=64k \
-                       > /dev/null 2>&1
-               # This forces metadata updates the next time around
-               rm "$SCRATCH_MNT/junk"
-               sync
-       done 
-fi &
-
-if [ "$GENERATE_IO_LOAD_VIA_FSSTRESS" != FALSE ]
-then
-       STRESS_DIR="$SCRATCH_MNT/fsstress_test_dir"
-       mkdir "$STRESS_DIR"
-
-       while [ -f "$tmp/running" ]
-       do
-               # -n 10 makes this take about 10 seconds,
-               # This allows the loop to end shortly after $tmp/running
-               # is deleted
-               $here/ltp/fsstress -d "$STRESS_DIR" -n 10  > /dev/null 2>&1
-               sync
-       done
-
-       rm -rf "$STRESS_DIR"
-fi &
-
-ii=1
-
-while [ $ii -le "$ITERATIONS" ]
+# start fsstress loop in a background block
+{
+    STRESS_DIR="$SCRATCH_MNT/fsstress_test_dir"
+    mkdir "$STRESS_DIR"
+
+    procs=2
+    nops=200
+    while [ -f "$tmp.running" ]
+      do
+      #        -w ensures that the only ops are ones which cause write I/O
+      ltp/fsstress -d $STRESS_DIR -w -p $procs -n $nops $FSSTRESS_AVOID \
+         > /dev/null 2>&1
+    done
+
+    rm -r $STRESS_DIR/*
+    rmdir $STRESS_DIR
+} &
+
+i=0
+ITERATIONS=`expr $ITERATIONS - 1`
+
+echo | tee -a $seq.full
+while [ $i -le $ITERATIONS ]
 do
 do
+        echo "*** iteration: $i" | tee -a $seq.full
+       echo "*** freezing \$SCRATCH_MNT" | tee -a $seq.full
+       xfs_freeze -f "$SCRATCH_MNT" | tee -a $seq.full
+       [ $? != 0 ] && echo xfs_freeze -f "$SCRATCH_MNT" failed | \
+           tee -a $seq.full
+       sleep 2
+
+       echo "*** thawing  \$SCRATCH_MNT" | tee -a $seq.full
+       xfs_freeze -u "$SCRATCH_MNT" | tee -a $seq.full
+       [ $? != 0 ] && echo xfs_freeze -u "$SCRATCH_MNT" failed | \
+           tee -a $seq.full
+       sleep 2
+
+       echo  | tee -a $seq.full
+       i=`expr $i + 1`
+done
 
 
-       # Useful if running interactively, but not from the xfs test scripts
-       #echo $ii
-
-       # If the VFS lock patch is present, the calls to xfs_freeze
-       # are redundant, but should cause no problems
-       #       OPTIONAL
-       xfs_freeze -f "$SCRATCH_MNT"
-       [ $? != 0 ] && echo xfs_freeze -f "$SCRATCH_MNT" failed
-       (
-               lvcreate --snapshot --size 1G --name scratch_snap "$VG/scratch"\
-                       > /dev/null 2>&1
-               ret=$?
-               [ $ret != 0 ] && \
-                       echo "Snapshot $SCRATCH_MNT create failed, status=$ret"
-       ) &
-       SNAPSHOT_shell_pid=$!
-
-       # If the Snapshot has not completed in ten minutes, kill it
-       (
-               # I have NOT figured out how to kill the sleep 600 before
-               # it exits naturally.
-               # This does not cause a problem, but it clutters the ps table.
-               sleep 600
-
-               # The kill $TIMEOUT_shell_pid keeps the below from occuring
-               echo Snapshot Lockup Occured on loop $ii
-               xfs_freeze -u "$SCRATCH_MNT"
-               kill $$
-       ) &
-       TIMEOUT_shell_pid=$!
-
-       wait "$SNAPSHOT_shell_pid"
-
-       exec 2> /dev/null               # Send the shells stderr to /dev/null
-       kill "$TIMEOUT_shell_pid"       # Cancel the timeout
-       wait "$TIMEOUT_shell_pid"       # This causes consistent shell
-                                       # notification for some unknown reason
-       exec 2>&1                       # Put it back to the same as stdout
-
-       # If the VFS lock patch is present, the calls to xfs_freeze
-       # are redundant, but should cause no problems
-       #       OPTIONAL
-       xfs_freeze -u "$SCRATCH_MNT"
-       [ $? != 0 ] && echo xfs_freeze -u "$SCRATCH_MNT" failed
-       #         MANDANTORY   (end)
-
-       mount -t xfs -o ro,nouuid "$VG/scratch_snap" "$SCRATCH_SNAP_MNT"
-       [ $? -eq 0 ] || echo mount for "$SCRATCH_SNAP_MNT" failed
-
-       umount "$SCRATCH_SNAP_MNT"
-       [ $? -eq 0 ] || echo umount for "$SCRATCH_SNAP_MNT" failed
-
-       lvremove -f "$VG/scratch_snap" > /dev/null 2>&1
-       [ $? -eq 0 ] || echo lvremove for "$VG/scratch_snap" failed
-
-       ii=`expr $ii + 1`
+# stop fsstress iterations
+rm $tmp.running
 
 
-       sleep "$DELAY_BETWEEN_ITERATIONS"      
-       # The VG seems to need time to stabalize between snapshots
-       # With LVM 1.0.3 and XFS 1.1, I have tried this at 3600 seconds
-       # and still had failures
+# wait for fsstresses to finish
+wait
 
 
-done
+_check_scratch_fs
 
 
-# success, all done
-echo SUCCESS, COMPLETED ALL ITERATIONS WITH NO TIME OUTS!!!!!!!!!!!!
-status=0
-_cleanup
-exit 1   # _cleanup should exit, so we should never get here.
+exit 1
\ No newline at end of file
diff --git a/068.out b/068.out
index ec942c15ea17f0941fca573ce841f41fa2155098..363d0e9867165ba569a8de61170699098d40de1e 100644 (file)
--- a/068.out
+++ b/068.out
@@ -1,3 +1,43 @@
 QA output created by 068
 QA output created by 068
-SUCCESS, COMPLETED ALL ITERATIONS WITH NO TIME OUTS!!!!!!!!!!!!
-Cleanup beginning
+*** init FS
+
+*** iteration: 0
+*** freezing $SCRATCH_MNT
+*** thawing  $SCRATCH_MNT
+
+*** iteration: 1
+*** freezing $SCRATCH_MNT
+*** thawing  $SCRATCH_MNT
+
+*** iteration: 2
+*** freezing $SCRATCH_MNT
+*** thawing  $SCRATCH_MNT
+
+*** iteration: 3
+*** freezing $SCRATCH_MNT
+*** thawing  $SCRATCH_MNT
+
+*** iteration: 4
+*** freezing $SCRATCH_MNT
+*** thawing  $SCRATCH_MNT
+
+*** iteration: 5
+*** freezing $SCRATCH_MNT
+*** thawing  $SCRATCH_MNT
+
+*** iteration: 6
+*** freezing $SCRATCH_MNT
+*** thawing  $SCRATCH_MNT
+
+*** iteration: 7
+*** freezing $SCRATCH_MNT
+*** thawing  $SCRATCH_MNT
+
+*** iteration: 8
+*** freezing $SCRATCH_MNT
+*** thawing  $SCRATCH_MNT
+
+*** iteration: 9
+*** freezing $SCRATCH_MNT
+*** thawing  $SCRATCH_MNT
+
diff --git a/new b/new
index 44345bc4d251449bd382a321e72995270d9c9a0e..53e0bb09135dba1ff6b278c793d451e81c5bfa89 100755 (executable)
--- a/new
+++ b/new
@@ -1,34 +1,25 @@
 #! /bin/sh
 #
 #! /bin/sh
 #
-# Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
-# 
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it would be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# 
-# Further, this software is distributed without any warranty that it is
-# free of the rightful claim of any third person regarding infringement
-# or the like.  Any license provided herein, whether implied or
-# otherwise, applies only to this software file.  Patent licenses, if
-# any, provided herein do not apply to combinations of this program with
-# other software, or any other product whatsoever.
-# 
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston MA 02111-1307, USA.
-# 
-# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
-# Mountain View, CA  94043, or:
-# 
-# http://www.sgi.com 
-# 
-# For further information regarding this notice, see: 
-# 
-# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+#-----------------------------------------------------------------------
+#  Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+#  USA
+#
+#  Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
+#  Mountain View, CA 94043, USA, or: http://www.sgi.com
+#-----------------------------------------------------------------------
 #
 #
 # Make a new test
 #
 #
 # Make a new test
@@ -99,7 +90,7 @@ cat <<End-of-File >$id
 # what am I here for?
 #
 #-----------------------------------------------------------------------
 # what am I here for?
 #
 #-----------------------------------------------------------------------
-# Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+# Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
 # 
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of version 2 of the GNU General Public License as
 # 
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of version 2 of the GNU General Public License as