2014-01-20 06:22:33 +00:00
|
|
|
#!/bin/bash
|
2018-06-09 11:35:42 +10:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
# Copyright (c) 2013 Red Hat, Inc. All Rights Reserved.
|
|
|
|
|
#
|
2015-02-12 14:20:27 +11:00
|
|
|
# FS QA Test No. 051
|
2014-01-20 06:22:33 +00:00
|
|
|
#
|
|
|
|
|
# Basic log recovery stress test - do lots of stuff, shut down in the middle of
|
|
|
|
|
# it and check that recovery runs to completion and everything can be
|
|
|
|
|
# successfully removed afterwards..
|
|
|
|
|
#
|
|
|
|
|
seq=`basename $0`
|
|
|
|
|
seqres=$RESULT_DIR/$seq
|
|
|
|
|
echo "QA output created by $seq"
|
|
|
|
|
|
|
|
|
|
here=`pwd`
|
|
|
|
|
tmp=/tmp/$$
|
|
|
|
|
status=1 # failure is the default!
|
|
|
|
|
|
|
|
|
|
# get standard environment, filters and checks
|
|
|
|
|
. ./common/rc
|
|
|
|
|
. ./common/filter
|
|
|
|
|
|
|
|
|
|
_cleanup()
|
|
|
|
|
{
|
|
|
|
|
cd /
|
2015-12-21 18:07:43 +11:00
|
|
|
_scratch_unmount 2>/dev/null
|
2014-01-20 06:22:33 +00:00
|
|
|
rm -f $tmp.*
|
|
|
|
|
}
|
|
|
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
|
|
|
|
|
|
# real QA test starts here
|
2015-02-12 14:20:27 +11:00
|
|
|
_supported_fs generic
|
2014-01-20 06:22:33 +00:00
|
|
|
_supported_os Linux
|
|
|
|
|
|
|
|
|
|
_require_scratch
|
2015-02-12 14:14:52 +11:00
|
|
|
_require_scratch_shutdown
|
2016-06-13 11:58:01 +09:00
|
|
|
_require_command "$KILLALL_PROG" killall
|
2014-01-20 06:22:33 +00:00
|
|
|
|
|
|
|
|
rm -f $seqres.full
|
|
|
|
|
|
|
|
|
|
_scratch_mkfs > $seqres.full 2>&1
|
2017-03-06 19:45:57 +08:00
|
|
|
_require_metadata_journaling $SCRATCH_DEV
|
2014-01-20 06:22:33 +00:00
|
|
|
_scratch_mount
|
|
|
|
|
|
|
|
|
|
SLEEP_TIME=$((30 * $TIME_FACTOR))
|
|
|
|
|
PROCS=$((2 * LOAD_FACTOR))
|
|
|
|
|
|
|
|
|
|
load_dir=$SCRATCH_MNT/test
|
|
|
|
|
|
|
|
|
|
# let this run for a while
|
2017-02-05 01:53:34 -05:00
|
|
|
$FSSTRESS_PROG $FSSTRESS_AVOID -n10000000 -p $PROCS -d $load_dir >> $seqres.full 2>&1 &
|
2014-01-20 06:22:33 +00:00
|
|
|
sleep $SLEEP_TIME
|
2016-06-13 11:58:01 +09:00
|
|
|
$KILLALL_PROG -q $FSSTRESS_PROG
|
2014-01-20 06:22:33 +00:00
|
|
|
wait
|
|
|
|
|
sync
|
2015-12-21 18:07:43 +11:00
|
|
|
_scratch_unmount
|
2014-01-20 06:22:33 +00:00
|
|
|
|
|
|
|
|
# now mount again, run the load again, this time with a shutdown.
|
|
|
|
|
_scratch_mount
|
|
|
|
|
$XFS_FSR_PROG -v $load_dir >> $seqres.full 2>&1
|
|
|
|
|
$FSSTRESS_PROG -n10000000 -p $PROCS -d $load_dir >> $seqres.full 2>&1 &
|
|
|
|
|
sleep $SLEEP_TIME
|
|
|
|
|
sync
|
|
|
|
|
|
|
|
|
|
# now shutdown and unmount
|
|
|
|
|
sleep 5
|
2017-12-15 15:47:33 +08:00
|
|
|
_scratch_shutdown
|
2016-06-13 11:58:01 +09:00
|
|
|
$KILLALL_PROG -q $FSSTRESS_PROG
|
2014-01-20 06:22:33 +00:00
|
|
|
wait
|
|
|
|
|
|
|
|
|
|
# for some reason fsstress processes manage to live on beyond the wait?
|
|
|
|
|
sleep 5
|
2015-12-21 18:07:43 +11:00
|
|
|
_scratch_unmount
|
2014-01-20 06:22:33 +00:00
|
|
|
|
|
|
|
|
# now recover, check the filesystem for consistency
|
|
|
|
|
_scratch_mount
|
2015-12-21 18:07:43 +11:00
|
|
|
_scratch_unmount
|
2014-01-20 06:22:33 +00:00
|
|
|
_check_scratch_fs
|
|
|
|
|
|
|
|
|
|
# now clean up.
|
|
|
|
|
_scratch_mount
|
|
|
|
|
for d in $load_dir/*; do
|
|
|
|
|
rm -rf $d > /dev/null 2>&1 &
|
|
|
|
|
done
|
|
|
|
|
wait
|
2015-12-21 18:07:43 +11:00
|
|
|
_scratch_unmount
|
2014-01-20 06:22:33 +00:00
|
|
|
|
|
|
|
|
echo "No output is good. Failures are loud."
|
|
|
|
|
|
|
|
|
|
status=0
|
|
|
|
|
exit
|