Files
apfstests/tests/generic/068
T

134 lines
3.3 KiB
Bash
Raw Normal View History

#! /bin/bash
# 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
#
#-----------------------------------------------------------------------
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=0 # success is the default!
ITERATIONS=10
_cleanup()
{
cd /
trap 0 1 2 3 15
exit $status
}
trap "_cleanup" 0 1 2 3 15
# get standard environment, filters and checks
2013-03-15 12:28:04 +00:00
. ./common/rc
. ./common/filter
2004-06-15 07:32:36 +00:00
# real QA test starts here
_supported_fs generic
_supported_os Linux IRIX
2004-06-15 07:32:36 +00:00
_require_scratch
_require_freeze
echo "*** init FS"
rm -f $seqres.full
2015-12-21 18:07:43 +11:00
_scratch_unmount >/dev/null 2>&1
echo "*** MKFS ***" >>$seqres.full
echo "" >>$seqres.full
_scratch_mkfs >>$seqres.full 2>&1 \
|| _fail "mkfs failed"
_scratch_mount >>$seqres.full 2>&1 \
|| _fail "mount failed"
touch $tmp.running
# 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
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_ARGS=`_scale_fsstress_args -d $STRESS_DIR -p $procs -n $nops $FSSTRESS_AVOID`
$FSSTRESS_PROG $FSSTRESS_ARGS > /dev/null 2>&1
done
rm -r $STRESS_DIR/*
rmdir $STRESS_DIR
} &
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
} &
i=0
2009-03-25 20:53:36 +01:00
let ITERATIONS=$ITERATIONS-1
echo | tee -a $seqres.full
while [ $i -le $ITERATIONS ]
do
echo "*** iteration: $i" | tee -a $seqres.full
echo "*** freezing \$SCRATCH_MNT" | tee -a $seqres.full
xfs_freeze -f "$SCRATCH_MNT" | tee -a $seqres.full
[ $? != 0 ] && echo xfs_freeze -f "$SCRATCH_MNT" failed | \
tee -a $seqres.full
sleep 2
echo "*** thawing \$SCRATCH_MNT" | tee -a $seqres.full
xfs_freeze -u "$SCRATCH_MNT" | tee -a $seqres.full
[ $? != 0 ] && echo xfs_freeze -u "$SCRATCH_MNT" failed | \
tee -a $seqres.full
sleep 2
echo | tee -a $seqres.full
2009-03-25 20:53:36 +01:00
let i=$i+1
done
# stop fsstress iterations
rm $tmp.running
# wait for fsstresses to finish
wait
2009-03-25 20:53:36 +01:00
exit 1