2010-01-20 10:27:08 +11:00
|
|
|
#! /bin/bash
|
2009-05-28 17:04:15 +02:00
|
|
|
# FSQA Test No. 068
|
|
|
|
|
#
|
|
|
|
|
# Test case to reproduce xfs_freeze hang under filsystem load.
|
|
|
|
|
# The fail case for this test is a hang on an xfs_freeze.
|
2009-05-12 13:24:15 -05:00
|
|
|
#
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
# 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.
|
|
|
|
|
#
|
|
|
|
|
# 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. 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 the Free Software Foundation,
|
|
|
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
#
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
#
|
2002-09-02 06:04:01 +00:00
|
|
|
# creator
|
2005-02-09 02:49:23 +00:00
|
|
|
owner=ajones@sgi.com
|
2002-09-02 06:04:01 +00:00
|
|
|
|
|
|
|
|
seq=`basename $0`
|
|
|
|
|
echo "QA output created by $seq"
|
|
|
|
|
|
|
|
|
|
here=`pwd`
|
2002-09-03 06:34:06 +00:00
|
|
|
tmp=/tmp/$$
|
2005-02-09 02:49:23 +00:00
|
|
|
status=0 # success is the default!
|
2002-09-02 06:04:01 +00:00
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
ITERATIONS=10
|
2002-09-02 06:04:01 +00:00
|
|
|
|
|
|
|
|
_cleanup()
|
|
|
|
|
{
|
2005-02-09 02:49:23 +00:00
|
|
|
cd /
|
|
|
|
|
_cleanup_testdir
|
2002-09-02 06:04:01 +00:00
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
trap 0 1 2 3 15
|
|
|
|
|
exit $status
|
2002-09-02 06:04:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trap "_cleanup" 0 1 2 3 15
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# get standard environment, filters and checks
|
|
|
|
|
. ./common.rc
|
|
|
|
|
. ./common.filter
|
|
|
|
|
|
2004-06-15 07:32:36 +00:00
|
|
|
# real QA test starts here
|
2012-09-19 17:53:56 -05:00
|
|
|
_supported_fs generic
|
2005-02-09 02:49:23 +00:00
|
|
|
_supported_os Linux IRIX
|
2004-06-15 07:32:36 +00:00
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
_require_scratch
|
2012-09-19 17:53:56 -05:00
|
|
|
_require_freeze
|
2002-09-02 06:04:01 +00:00
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
echo "*** init FS"
|
2002-09-02 06:04:01 +00:00
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
rm -f $seq.full
|
|
|
|
|
umount $SCRATCH_DEV >/dev/null 2>&1
|
|
|
|
|
echo "*** MKFS ***" >>$seq.full
|
|
|
|
|
echo "" >>$seq.full
|
2011-12-14 11:22:10 +09:00
|
|
|
_scratch_mkfs >>$seq.full 2>&1 \
|
2005-02-09 02:49:23 +00:00
|
|
|
|| _fail "mkfs failed"
|
|
|
|
|
_scratch_mount >>$seq.full 2>&1 \
|
|
|
|
|
|| _fail "mount failed"
|
|
|
|
|
|
|
|
|
|
touch $tmp.running
|
2002-09-02 06:04:01 +00:00
|
|
|
|
|
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
# start fsstress loop in a background block
|
|
|
|
|
{
|
|
|
|
|
STRESS_DIR="$SCRATCH_MNT/fsstress_test_dir"
|
|
|
|
|
mkdir "$STRESS_DIR"
|
2002-09-02 06:04:01 +00:00
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
procs=2
|
|
|
|
|
nops=200
|
|
|
|
|
while [ -f "$tmp.running" ]
|
|
|
|
|
do
|
2012-02-08 12:30:07 -06:00
|
|
|
# We do both read & write IO - not only is this more realistic,
|
|
|
|
|
# but it also potentially tests atime updates
|
|
|
|
|
$FSSTRESS_PROG -d $STRESS_DIR -p $procs -n $nops $FSSTRESS_AVOID \
|
2005-02-09 02:49:23 +00:00
|
|
|
> /dev/null 2>&1
|
|
|
|
|
done
|
2002-09-02 06:04:01 +00:00
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
rm -r $STRESS_DIR/*
|
|
|
|
|
rmdir $STRESS_DIR
|
|
|
|
|
} &
|
2002-09-02 06:04:01 +00:00
|
|
|
|
2012-09-28 03:33:45 +00:00
|
|
|
# start fstest -m loop in a background block; this gets us mmap coverage
|
|
|
|
|
{
|
|
|
|
|
FSTEST_DIR="$SCRATCH_MNT/fstest_test_dir"
|
|
|
|
|
mkdir "$FSTEST_DIR"
|
|
|
|
|
|
|
|
|
|
procs=2
|
|
|
|
|
while [ -f "$tmp.running" ]
|
|
|
|
|
do
|
|
|
|
|
src/fstest -m -p $FSTEST_DIR -n $procs -f 4 > /dev/null 2>&1
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
rm -rf $FSTEST_DIR/*
|
|
|
|
|
rmdir $FSTEST_DIR
|
|
|
|
|
} &
|
|
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
i=0
|
2009-03-25 20:53:36 +01:00
|
|
|
let ITERATIONS=$ITERATIONS-1
|
2002-09-02 06:04:01 +00:00
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
echo | tee -a $seq.full
|
|
|
|
|
while [ $i -le $ITERATIONS ]
|
2002-09-02 06:04:01 +00:00
|
|
|
do
|
2005-02-09 02:49:23 +00:00
|
|
|
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
|
2002-09-02 06:04:01 +00:00
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
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
|
2002-09-02 06:04:01 +00:00
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
echo | tee -a $seq.full
|
2009-03-25 20:53:36 +01:00
|
|
|
let i=$i+1
|
2002-09-02 06:04:01 +00:00
|
|
|
done
|
|
|
|
|
|
2005-02-09 02:49:23 +00:00
|
|
|
# stop fsstress iterations
|
|
|
|
|
rm $tmp.running
|
|
|
|
|
|
|
|
|
|
# wait for fsstresses to finish
|
|
|
|
|
wait
|
|
|
|
|
|
|
|
|
|
_check_scratch_fs
|
|
|
|
|
|
2009-03-25 20:53:36 +01:00
|
|
|
exit 1
|