@@ -12,13 +12,13 @@ _scratch_fuzz_modify() {
echo "+++ stressing filesystem"
mkdir -p $SCRATCH_MNT/data
[ "$FSTYP" == "xfs" ] && _xfs_force_bdev data $SCRATCH_MNT/data
- $FSSTRESS_PROG "${fsstress_args[@]}" -d $SCRATCH_MNT/data
+ _run_fsstress "${fsstress_args[@]}" -d $SCRATCH_MNT/data
if [ "$FSTYP" = "xfs" ]; then
if _xfs_has_feature "$SCRATCH_MNT" realtime; then
mkdir -p $SCRATCH_MNT/rt
_xfs_force_bdev realtime $SCRATCH_MNT/rt
- $FSSTRESS_PROG "${fsstress_args[@]}" -d $SCRATCH_MNT/rt
+ _run_fsstress "${fsstress_args[@]}" -d $SCRATCH_MNT/rt
else
echo "+++ xfs realtime not configured"
fi
@@ -965,7 +965,7 @@ __stress_scrub_fsx_loop() {
res=$?
echo "$mode fsx exits with $res at $(date)" >> $seqres.full
if [ "$res" -ne 0 ] && [ "$res" -ne 124 ]; then
- # Stop if fsstress returns error. Mask off
+ # Stop if fsx returns error. Mask off
# the magic code 124 because that is how the
# timeout(1) program communicates that we ran
# out of time.
@@ -1096,7 +1096,7 @@ __stress_scrub_fsstress_loop() {
# As of March 2022, 2 million fsstress ops should be enough to keep
# any filesystem busy for a couple of hours.
- local args=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000000 "${focus[@]}" $FSSTRESS_AVOID)
+ local args=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000000 "${focus[@]}")
echo "Running $FSSTRESS_PROG $args" >> $seqres.full
if [ -n "$remount_period" ]; then
@@ -1107,17 +1107,13 @@ __stress_scrub_fsstress_loop() {
# anything.
test "$mode" = "rw" && __stress_scrub_clean_scratch && continue
- timeout -s TERM "$remount_period" $FSSTRESS_PROG \
- $args $rw_arg >> $seqres.full
+ _run_fsstress_bg $args $rw_arg >> $seqres.full
+ sleep $remount_period
+ _kill_fsstress
res=$?
echo "$mode fsstress exits with $res at $(date)" >> $seqres.full
- if [ "$res" -ne 0 ] && [ "$res" -ne 124 ]; then
- # Stop if fsstress returns error. Mask off
- # the magic code 124 because that is how the
- # timeout(1) program communicates that we ran
- # out of time.
- break;
- fi
+ [ "$res" -ne 0 ] && break;
+
if [ "$mode" = "rw" ]; then
mode="ro"
rw_arg="-R"
@@ -1139,7 +1135,7 @@ __stress_scrub_fsstress_loop() {
while __stress_scrub_running "$end" "$runningfile"; do
# Need to recheck running conditions if we cleared anything
__stress_scrub_clean_scratch && continue
- $FSSTRESS_PROG $args >> $seqres.full
+ _run_fsstress $args >> $seqres.full
echo "fsstress exits with $? at $(date)" >> $seqres.full
done
rm -f "$runningfile"
@@ -1181,7 +1177,8 @@ _scratch_xfs_stress_scrub_cleanup() {
# Send SIGINT so that bash won't print a 'Terminated' message that
# distorts the golden output.
echo "Killing stressor processes at $(date)" >> $seqres.full
- $KILLALL_PROG -INT xfs_io fsstress fsx xfs_scrub >> $seqres.full 2>&1
+ _kill_fsstress
+ $KILLALL_PROG -INT xfs_io fsx xfs_scrub >> $seqres.full 2>&1
# Tests are not allowed to exit with the scratch fs frozen. If we
# started a fs freeze/thaw background loop, wait for that loop to exit
@@ -1394,6 +1391,7 @@ _scratch_xfs_stress_scrub() {
"__stress_scrub_${exerciser}_loop" "$end" "$runningfile" \
"$remount_period" "$stress_tgt" &
+ _FSSTRESS_PID=$!
if [ -n "$freeze" ]; then
__stress_scrub_freeze_loop "$end" "$runningfile" &
@@ -7,6 +7,7 @@
# Standard cleanup function. Individual tests can override this.
_cleanup()
{
+ _kill_fsstress
cd /
rm -r -f $tmp.*
}
@@ -6,6 +6,65 @@
BC="$(type -P bc)" || BC=
+# Common execution handling for fsstress invocation.
+#
+# We need per-test fsstress binaries because of the way fsstress forks and
+# tests run it in the background and/or nest it. Trying to kill fsstress
+# tasks is unreliable because killing parent fsstress task does not guarantee
+# that the children get killed. Hence the historic use of killall for stopping
+# execution.
+#
+# However, we can't just kill all fsstress binaries as multiple tests might be
+# running fsstress at the same time. Hence copy the fsstress binary to a test
+# specific binary on the test device and use pkill to select that only that
+# task name to kill.
+#
+# If tasks want to start fsstress themselves (e.g. under a different uid) then
+# they can set up _FSSTRESS_BIN and record _FSSTRESS_PID themselves. Then if the
+# test is killed then it will get cleaned up automatically.
+
+_FSSTRESS_BIN="$seq.fsstress"
+_FSSTRESS_PROG="$TEST_DIR/$seq.fsstress"
+_FSSTRESS_PID=""
+_wait_for_fsstress()
+{
+ local ret=0
+
+ if [ -n "$_FSSTRESS_PID" ]; then
+ wait $_FSSTRESS_PID >> $seqres.full 2>&1
+ ret=$?
+ unset _FSSTRESS_PID
+ fi
+ rm -f $_FSSTRESS_PROG
+ return $ret
+}
+
+# Standard fsstress cleanup function. Individual tests can override this.
+_kill_fsstress()
+{
+ if [ -n "$_FSSTRESS_PID" ]; then
+ # use SIGPIPE to avoid "Killed" messages from bash
+ echo "killing $_FSSTRESS_BIN" >> $seqres.full
+ pkill -PIPE $_FSSTRESS_BIN >> $seqres.full 2>&1
+ _wait_for_fsstress
+ return $?
+ fi
+}
+
+_run_fsstress_bg()
+{
+ cp -f $FSSTRESS_PROG $_FSSTRESS_PROG
+ $_FSSTRESS_PROG $FSSTRESS_AVOID $* >> $seqres.full 2>&1 &
+ _FSSTRESS_PID=$!
+}
+
+_run_fsstress()
+{
+ _run_fsstress_bg $*
+ _wait_for_fsstress
+ return $?
+}
+
_wallclock()
{
date "+%s"
@@ -444,6 +444,7 @@ void sg_handler(int signum)
{
switch (signum) {
case SIGTERM:
+ case SIGPIPE:
should_stop = 1;
break;
case SIGBUS:
@@ -469,6 +470,9 @@ keep_looping(int i, int loops)
{
int ret;
+ if (should_stop)
+ return false;
+
if (deadline.tv_nsec) {
struct timespec now;
@@ -732,14 +736,17 @@ int main(int argc, char **argv)
perror("sigaction failed");
exit(1);
}
+ if (sigaction(SIGPIPE, &action, 0)) {
+ perror("sigaction failed");
+ exit(1);
+ }
for (i = 0; i < nproc; i++) {
if (fork() == 0) {
sigemptyset(&action.sa_mask);
- action.sa_handler = SIG_DFL;
- if (sigaction(SIGTERM, &action, 0))
- return 1;
action.sa_handler = sg_handler;
+ if (sigaction(SIGTERM, &action, 0))
+ return 1;
if (sigaction(SIGBUS, &action, 0))
return 1;
#ifdef HAVE_SYS_PRCTL_H
@@ -1196,6 +1203,9 @@ keep_running(opnum_t opno, opnum_t operations)
{
int ret;
+ if (should_stop)
+ return false;
+
if (deadline.tv_nsec) {
struct timespec now;
@@ -17,6 +17,7 @@ noise_pid=0
# Override the default cleanup function.
_cleanup()
{
+ _kill_fsstress
rm $tmp.running
wait
rm -f $tmp.*
@@ -159,8 +160,7 @@ workout()
_scratch_mkfs_sized $fsz >>$seqres.full 2>&1
_scratch_mount
# -w ensures that the only ops are ones which cause write I/O
- run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p $procs -n 2000 \
- $FSSTRESS_AVOID
+ _run_fsstress -d $SCRATCH_MNT -w -p $procs -n 2000
_btrfs subvolume snapshot $SCRATCH_MNT \
$SCRATCH_MNT/$snap_name
@@ -170,15 +170,14 @@ workout()
# make some noise but ensure we're not touching existing data
# extents.
- run_check $FSSTRESS_PROG -d $SCRATCH_MNT -p $procs -n 4000 \
+ _run_fsstress -d $SCRATCH_MNT -p $procs -n 4000 \
-z -f chown=3 -f link=1 -f mkdir=2 -f mknod=2 \
-f rename=2 -f setxattr=1 -f symlink=2
clean_dir="$SCRATCH_MNT/next"
mkdir $clean_dir
# now make more files to get a higher tree
- run_check $FSSTRESS_PROG -d $clean_dir -w -p $procs -n 2000 \
- $FSSTRESS_AVOID
+ _run_fsstress -d $clean_dir -w -p $procs -n 2000
run_check _scratch_unmount
_scratch_mount "-o atime"
@@ -186,7 +185,7 @@ workout()
# make background noise while backrefs are being walked
while [ -f "$tmp.running" ]; do
echo background fsstress >>$seqres.full
- run_check $FSSTRESS_PROG -d $SCRATCH_MNT/bgnoise -n 999
+ _run_fsstress -d $SCRATCH_MNT/bgnoise -n 999
echo background rm >>$seqres.full
rm -rf $SCRATCH_MNT/bgnoise/
done &
@@ -18,6 +18,7 @@ _begin_fstest auto quick rw metadata send seek
# Override the default cleanup function.
_cleanup()
{
+ _kill_fsstress
cd /
rm -f $tmp.*
rm -fr $send_files_dir
@@ -45,7 +46,7 @@ workout()
_scratch_mkfs_sized $fsz >>$seqres.full 2>&1
_scratch_mount "-o noatime"
- run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n $ops $FSSTRESS_AVOID -x \
+ _run_fsstress -d $SCRATCH_MNT -n $ops -x \
"$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/base"
_btrfs subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/incr
@@ -45,7 +45,7 @@ mount -t ext4 $SCRATCH_DEV $SCRATCH_MNT
echo "populating the initial ext fs:" >> $seqres.full
mkdir "$SCRATCH_MNT/$BASENAME"
-$FSSTRESS_PROG -w -d "$SCRATCH_MNT/$BASENAME" -n 20 -p 500 >> $seqres.full
+_run_fsstress -w -d "$SCRATCH_MNT/$BASENAME" -n 20 -p 500
# Create the checksum to verify later.
$FSSUM_PROG -A -f -w $tmp.original "$SCRATCH_MNT/$BASENAME"
@@ -74,7 +74,7 @@ umount $SCRATCH_MNT/mnt
echo "Generating new data on the converted btrfs" >> $seqres.full
mkdir -p $SCRATCH_MNT/new
-$FSSTRESS_PROG -w -d "$SCRATCH_MNT/new" -n 20 -p 500 >> $seqres.full
+_run_fsstress -w -d "$SCRATCH_MNT/new" -n 20 -p 500
_scratch_unmount
@@ -32,8 +32,7 @@ args=`_scale_fsstress_args -z \
-f fsync=10 -n 100000 -p 2 \
-d $SCRATCH_MNT/stress_dir`
echo "Run fsstress $args" >>$seqres.full
-$FSSTRESS_PROG $args >>$seqres.full &
-fsstress_pid=$!
+_run_fsstress_bg $args
echo "Start balance" >>$seqres.full
_btrfs_stress_balance -d $SCRATCH_MNT >/dev/null 2>&1 &
@@ -41,8 +40,7 @@ balance_pid=$!
# 30s is enough to trigger bug
sleep $((30*$TIME_FACTOR))
-kill $fsstress_pid &> /dev/null
-wait $fsstress_pid &> /dev/null
+_kill_fsstress
_btrfs_kill_stress_balance_pid $balance_pid
# The qgroups accounting will be checked by 'btrfs check' (fsck) after the
@@ -39,7 +39,7 @@ args=`_scale_fsstress_args -z \
-f write=10 -f creat=10 \
-n 1000 -p 2 -d $SCRATCH_MNT/stress_dir`
echo "Run fsstress $args" >>$seqres.full
-$FSSTRESS_PROG $args >>$seqres.full
+_run_fsstress $args >>$seqres.full
# Start and pause balance to ensure it will be restored on remount
echo "Start balance" >>$seqres.full
@@ -68,7 +68,7 @@ $BTRFS_UTIL_PROG balance resume "$SCRATCH_MNT" &>/dev/null
[ $? -eq 0 ] || _fail "Couldn't resume balance after device add"
# Add more files so that new balance won't fish immediately
-$FSSTRESS_PROG $args >/dev/null 2>&1
+_run_fsstress $args
# Now pause->resume balance. This ensures balance paused is properly set in
# the kernel and won't trigger an assertion failure.
@@ -19,12 +19,12 @@ _scratch_mkfs_sized $((1024 * 1024 * 1024)) >> $seqres.full 2>&1
_scratch_mount
# -w ensures that the only ops are ones which cause write I/O
-run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p 5 -n 1000 $FSSTRESS_AVOID
+_run_fsstress -d $SCRATCH_MNT -w -p 5 -n 1000
_btrfs subvolume snapshot $SCRATCH_MNT \
$SCRATCH_MNT/snap1
-run_check $FSSTRESS_PROG -d $SCRATCH_MNT/snap1 -w -p 5 -n 1000 $FSSTRESS_AVOID
+_run_fsstress -d $SCRATCH_MNT/snap1 -w -p 5 -n 1000
_btrfs quota enable $SCRATCH_MNT
_btrfs quota rescan -w $SCRATCH_MNT
@@ -21,10 +21,7 @@ _cleanup()
if [ ! -z "$balance_pid" ]; then
_btrfs_kill_stress_balance_pid $balance_pid
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -51,10 +48,9 @@ run_test()
fi
_scratch_mount >>$seqres.full 2>&1
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start balance worker: " >>$seqres.full
_btrfs_stress_balance $SCRATCH_MNT >/dev/null 2>&1 &
@@ -67,9 +63,7 @@ run_test()
echo "$subvol_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
-
+ _wait_for_fsstress
_btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file $subvol_mnt
unset subvol_pid
_btrfs_kill_stress_balance_pid $balance_pid
@@ -20,10 +20,7 @@ _cleanup()
if [ ! -z "$scrub_pid" ]; then
_btrfs_kill_stress_scrub_pid $scrub_pid
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -47,10 +44,9 @@ run_test()
fi
_scratch_mount >>$seqres.full 2>&1
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start balance worker: " >>$seqres.full
_btrfs_stress_balance $SCRATCH_MNT >/dev/null 2>&1 &
@@ -63,8 +59,7 @@ run_test()
echo "$scrub_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
+ _wait_for_fsstress
_btrfs_kill_stress_balance_pid $balance_pid
unset balance_pid
_btrfs_kill_stress_scrub_pid $scrub_pid
@@ -20,10 +20,7 @@ _cleanup()
if [ ! -z "$defrag_pid" ]; then
_btrfs_kill_stress_defrag_pid $defrag_pid
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -48,10 +45,9 @@ run_test()
fi
_scratch_mount >>$seqres.full 2>&1
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start balance worker: " >>$seqres.full
_btrfs_stress_balance $SCRATCH_MNT >/dev/null 2>&1 &
@@ -64,8 +60,7 @@ run_test()
echo "$defrag_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
+ _wait_for_fsstress
_btrfs_kill_stress_balance_pid $balance_pid
unset balance_pid
_btrfs_kill_stress_defrag_pid $defrag_pid
@@ -20,10 +20,7 @@ _cleanup()
if [ ! -z "$remount_pid" ]; then
_btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -47,10 +44,9 @@ run_test()
fi
_scratch_mount >>$seqres.full 2>&1
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start balance worker: " >>$seqres.full
_btrfs_stress_balance $SCRATCH_MNT >/dev/null 2>&1 &
@@ -63,8 +59,7 @@ run_test()
echo "$remount_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
+ _wait_for_fsstress
_btrfs_kill_stress_balance_pid $balance_pid
unset balance_pid
_btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
@@ -22,10 +22,7 @@ _cleanup()
if [ ! -z "$replace_pid" ]; then
_btrfs_kill_stress_replace_pid $replace_pid
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -57,10 +54,9 @@ run_test()
_scratch_mount >>$seqres.full 2>&1
SCRATCH_DEV_POOL=$saved_scratch_dev_pool
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
# Start both balance and replace in the background.
# Either balance or replace shall run, the other fails.
@@ -75,8 +71,7 @@ run_test()
echo "$replace_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
+ _wait_for_fsstress
_btrfs_kill_stress_balance_pid $balance_pid
unset balance_pid
_btrfs_kill_stress_replace_pid $replace_pid
@@ -21,10 +21,7 @@ _cleanup()
if [ ! -z "$replace_pid" ]; then
_btrfs_kill_stress_replace_pid $replace_pid
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -59,10 +56,9 @@ run_test()
_scratch_mount >>$seqres.full 2>&1
SCRATCH_DEV_POOL=$saved_scratch_dev_pool
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start subvolume worker: " >>$seqres.full
_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
@@ -75,9 +71,7 @@ run_test()
echo "$replace_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
-
+ _wait_for_fsstress
_btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file $subvol_mnt
unset subvol_pid
_btrfs_kill_stress_replace_pid $replace_pid
@@ -21,10 +21,7 @@ _cleanup()
if [ ! -z "$scrub_pid" ]; then
_btrfs_kill_stress_scrub_pid $scrub_pid
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -51,10 +48,9 @@ run_test()
fi
_scratch_mount >>$seqres.full 2>&1
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start subvolume worker: " >>$seqres.full
_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
@@ -67,9 +63,7 @@ run_test()
echo "$scrub_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
-
+ _wait_for_fsstress
_btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file $subvol_mnt
unset subvol_pid
_btrfs_kill_stress_scrub_pid $scrub_pid
@@ -21,10 +21,7 @@ _cleanup()
if [ ! -z "$defrag_pid" ]; then
_btrfs_kill_stress_defrag_pid $defrag_pid
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -52,10 +49,9 @@ run_test()
fi
_scratch_mount >>$seqres.full 2>&1
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start subvolume worker: " >>$seqres.full
_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
@@ -68,9 +64,7 @@ run_test()
echo "$defrag_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
-
+ _wait_for_fsstress
_btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file $subvol_mnt
unset subvol_pid
_btrfs_kill_stress_defrag_pid $defrag_pid
@@ -22,10 +22,7 @@ _cleanup()
if [ ! -z "$remount_pid" ]; then
_btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -52,10 +49,9 @@ run_test()
fi
_scratch_mount >>$seqres.full 2>&1
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start subvolume worker: " >>$seqres.full
_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
@@ -68,9 +64,7 @@ run_test()
echo "$remount_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
-
+ _wait_for_fsstress
_btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file $subvol_mnt
unset subvol_pid
_btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
@@ -20,10 +20,7 @@ _cleanup()
if [ ! -z "$scrub_pid" ]; then
_btrfs_kill_stress_scrub_pid $scrub_pid
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -55,10 +52,9 @@ run_test()
_scratch_mount >>$seqres.full 2>&1
SCRATCH_DEV_POOL=$saved_scratch_dev_pool
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start replace worker: " >>$seqres.full
_btrfs_stress_replace $SCRATCH_MNT >>$seqres.full 2>&1 &
@@ -71,8 +67,7 @@ run_test()
echo "$scrub_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
+ _wait_for_fsstress
_btrfs_kill_stress_scrub_pid $scrub_pid
unset scrub_pid
_btrfs_kill_stress_replace_pid $replace_pid
@@ -20,10 +20,7 @@ _cleanup()
if [ ! -z "$defrag_pid" ]; then
_btrfs_kill_stress_defrag_pid $defrag_pid
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -56,10 +53,9 @@ run_test()
_scratch_mount >>$seqres.full 2>&1
SCRATCH_DEV_POOL=$saved_scratch_dev_pool
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start replace worker: " >>$seqres.full
_btrfs_stress_replace $SCRATCH_MNT >>$seqres.full 2>&1 &
@@ -72,8 +68,7 @@ run_test()
echo "$defrag_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
+ _wait_for_fsstress
_btrfs_kill_stress_replace_pid $replace_pid
unset replace_pid
_btrfs_kill_stress_defrag_pid $defrag_pid
@@ -20,10 +20,7 @@ _cleanup()
if [ ! -z "$remount_pid" ]; then
_btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -55,10 +52,9 @@ run_test()
_scratch_mount >>$seqres.full 2>&1
SCRATCH_DEV_POOL=$saved_scratch_dev_pool
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start replace worker: " >>$seqres.full
_btrfs_stress_replace $SCRATCH_MNT >>$seqres.full 2>&1 &
@@ -71,8 +67,7 @@ run_test()
echo "$remount_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
+ _wait_for_fsstress
_btrfs_kill_stress_replace_pid $replace_pid
unset replace_pid
_btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
@@ -20,10 +20,7 @@ _cleanup()
if [ ! -z "$scrub_pid" ]; then
_btrfs_kill_stress_scrub_pid $scrub_pid
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -48,10 +45,9 @@ run_test()
fi
_scratch_mount >>$seqres.full 2>&1
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start scrub worker: " >>$seqres.full
_btrfs_stress_scrub $SCRATCH_MNT >/dev/null 2>&1 &
@@ -64,9 +60,7 @@ run_test()
echo "$defrag_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
-
+ _wait_for_fsstress
_btrfs_kill_stress_defrag_pid $defrag_pid
unset defrag_pid
_btrfs_kill_stress_scrub_pid $scrub_pid
@@ -20,10 +20,7 @@ _cleanup()
if [ ! -z "$scrub_pid" ]; then
_btrfs_kill_stress_scrub_pid $scrub_pid
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -47,10 +44,9 @@ run_test()
fi
_scratch_mount >>$seqres.full 2>&1
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start scrub worker: " >>$seqres.full
_btrfs_stress_scrub $SCRATCH_MNT >/dev/null 2>&1 &
@@ -63,8 +59,7 @@ run_test()
echo "$remount_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
+ _wait_for_fsstress
_btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
unset remount_pid
_btrfs_kill_stress_scrub_pid $scrub_pid
@@ -20,10 +20,7 @@ _cleanup()
if [ ! -z "$defrag_pid" ]; then
_btrfs_kill_stress_defrag_pid $defrag_pid
fi
- if [ ! -z "$fsstress_pid" ]; then
- kill $fsstress_pid &> /dev/null
- wait $fsstress_pid &> /dev/null
- fi
+ _kill_fsstress
}
. ./common/filter
@@ -48,10 +45,9 @@ run_test()
fi
_scratch_mount >>$seqres.full 2>&1
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $SCRATCH_MNT/stressdir`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
+ _run_fsstress_bg $args
echo -n "Start defrag worker: " >>$seqres.full
_btrfs_stress_defrag $SCRATCH_MNT $with_compress >/dev/null 2>&1 &
@@ -64,8 +60,7 @@ run_test()
echo "$remount_pid" >>$seqres.full
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
- wait $fsstress_pid
- unset fsstress_pid
+ _wait_for_fsstress
_btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
unset remount_pid
_btrfs_kill_stress_defrag_pid $defrag_pid
@@ -16,14 +16,6 @@
. ./common/preamble
_begin_fstest auto snapshot
-tmp=`mktemp -d`
-
-# Override the default cleanup function.
-_cleanup()
-{
- rm -fr $tmp
-}
-
. ./common/filter
_require_scratch
@@ -39,8 +31,8 @@ workout()
snapshot_cmd="$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT"
snapshot_cmd="$snapshot_cmd $SCRATCH_MNT/snap_\`date +'%H_%M_%S_%N'\`"
- run_check $FSSTRESS_PROG -p $procs \
- -x "$snapshot_cmd" -X $num_snapshots -d $SCRATCH_MNT -n $ops
+ _run_fsstress -p $procs -x "$snapshot_cmd" -X $num_snapshots \
+ -d $SCRATCH_MNT -n $ops
}
ops=8000
@@ -13,6 +13,7 @@ _begin_fstest auto replace volume eio
# Override the default cleanup function.
_cleanup()
{
+ _kill_fsstress
_dmerror_cleanup
rm -f $tmp.*
}
@@ -39,8 +40,7 @@ error_devid=`$BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT |\
snapshot_cmd="$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT"
snapshot_cmd="$snapshot_cmd $SCRATCH_MNT/snap_\`date +'%H_%M_%S_%N'\`"
-run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \
- "$snapshot_cmd" -X 50
+_run_fsstress -d $SCRATCH_MNT -n 200 -p 8 -x "$snapshot_cmd" -X 50
# now load the error into the DMERROR_DEV
_dmerror_load_error_table
@@ -13,6 +13,7 @@ _begin_fstest auto replace volume eio
# Override the default cleanup function.
_cleanup()
{
+ _kill_fsstress
_dmerror_cleanup
rm -f $tmp.*
}
@@ -40,8 +41,7 @@ error_devid=`$BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT |\
snapshot_cmd="$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT"
snapshot_cmd="$snapshot_cmd $SCRATCH_MNT/snap_\`date +'%H_%M_%S_%N'\`"
-run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \
- "$snapshot_cmd" -X 50
+_run_fsstress -d $SCRATCH_MNT -n 200 -p 8 -x "$snapshot_cmd" -X 50
# now load the error into the DMERROR_DEV
_dmerror_load_error_table
@@ -34,11 +34,9 @@ BTRFS_MD5SUM="$tmp.btrfs"
populate_data(){
data_path=$1
mkdir -p $data_path
- args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $data_path`
+ args=`_scale_fsstress_args -p 20 -n 100 -d $data_path`
echo "Run fsstress $args" >>$seqres.full
- $FSSTRESS_PROG $args >>$seqres.full &
- fsstress_pid=$!
- wait $fsstress_pid
+ _run_fsstress $args
}
# Create & populate an ext3 filesystem
@@ -13,12 +13,12 @@ _begin_fstest auto replay snapshot stress recoveryloop
# Override the default cleanup function.
_cleanup()
{
- cd /
+ _kill_fsstress
kill -q $pid1 &> /dev/null
kill -q $pid2 &> /dev/null
- "$KILLALL_PROG" -q $FSSTRESS_PROG &> /dev/null
wait
_log_writes_cleanup &> /dev/null
+ cd /
rm -f $tmp.*
}
@@ -46,8 +46,7 @@ nr_cpus=$("$here/src/feature" -o)
if [ $nr_cpus -gt 8 ]; then
nr_cpus=8
fi
-fsstress_args=$(_scale_fsstress_args -w -d $SCRATCH_MNT -n 99999 -p $nr_cpus \
- $FSSTRESS_AVOID)
+fsstress_args=$(_scale_fsstress_args -w -d $SCRATCH_MNT -n 99999 -p $nr_cpus )
_log_writes_init $SCRATCH_DEV
# Discard the whole devices so when some tree pointer is wrong, it won't point
@@ -135,10 +134,10 @@ pid1=$!
delete_workload &
pid2=$!
-"$FSSTRESS_PROG" $fsstress_args >> $seqres.full &
+_run_fsstress_bg $fsstress_args
sleep $runtime
-"$KILLALL_PROG" -q "$FSSTRESS_PROG" &> /dev/null
+_kill_fsstress
kill $pid1 &> /dev/null
kill $pid2 &> /dev/null
wait
@@ -49,7 +49,7 @@ run_testcase() {
_scratch_mount
# Create random filesystem with 20k write ops
- $FSSTRESS_PROG -d $SCRATCH_MNT -w -n 10000 $FSSTRESS_AVOID >>$seqres.full 2>&1
+ _run_fsstress -d $SCRATCH_MNT -w -n 10000
_run_btrfs_balance_start -f -dconvert=$dst_type $SCRATCH_MNT >> $seqres.full
[ $? -eq 0 ] || echo "$1: Failed convert"
@@ -13,13 +13,13 @@ _begin_fstest auto balance dangerous
# Override the default cleanup function.
_cleanup()
{
- cd /
- rm -f $tmp.*
+ _kill_fsstress
kill $balance_pid &> /dev/null
kill $cancel_pid &> /dev/null
- "$KILLALL_PROG" -q $FSSTRESS_PROG &> /dev/null
- $BTRFS_UTIL_PROG balance cancel $SCRATCH_MNT &> /dev/null
wait
+ $BTRFS_UTIL_PROG balance cancel $SCRATCH_MNT &> /dev/null
+ cd /
+ rm -f $tmp.*
}
. ./common/filter
@@ -49,7 +49,7 @@ cancel_workload()
done
}
-$FSSTRESS_PROG -d $SCRATCH_MNT -w -n 100000 >> $seqres.full 2>/dev/null &
+_run_fsstress_bg -d $SCRATCH_MNT -w -n 100000
balance_workload &
balance_pid=$!
@@ -58,11 +58,11 @@ cancel_pid=$!
sleep $runtime
+_kill_fsstress
kill $balance_pid
kill $cancel_pid
-"$KILLALL_PROG" -q $FSSTRESS_PROG &> /dev/null
-$BTRFS_UTIL_PROG balance cancel $SCRATCH_MNT &> /dev/null
wait
+$BTRFS_UTIL_PROG balance cancel $SCRATCH_MNT &> /dev/null
echo "Silence is golden"
# success, all done
@@ -23,8 +23,8 @@ writer()
trap "wait; exit" SIGTERM
while true; do
- args=`_scale_fsstress_args -p 20 -n 1000 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
- $FSSTRESS_PROG $args >> $seqres.full
+ args=`_scale_fsstress_args -p 20 -n 1000 -d $SCRATCH_MNT/stressdir`
+ _run_fsstress $args
done
}
@@ -24,6 +24,7 @@ _begin_fstest auto send balance stress
_cleanup()
{
+ _kill_fsstress
if [ ! -z $balance_pid ]; then
kill $balance_pid &> /dev/null
wait $balance_pid
@@ -79,10 +80,10 @@ snapshot_cmd="$snapshot_cmd \"$snapshots_dir/snap_\`date +'%s%N'\`\""
# it's pointless to have them.
#
echo "Running fsstress..." >> $seqres.full
-$FSSTRESS_PROG $FSSTRESS_AVOID -d "$data_subvol" -p 1 -w \
+_run_fsstress -d "$data_subvol" -p 1 -w \
-f subvol_create=0 -f subvol_delete=0 -f snapshot=0 \
-x "$snapshot_cmd" -X $num_snapshots \
- -n $total_fsstress_ops >> $seqres.full
+ -n $total_fsstress_ops
snapshots=(`IFS=$'\n' ls -1 "$snapshots_dir"`)
@@ -35,7 +35,7 @@ prepare_fs()
# Then use fsstress to generate some extra contents.
# Disable setattr related operations, as it may set NODATACOW which will
# not allow us to use btrfs checksum to verify the content.
- $FSSTRESS_PROG -f setattr=0 -d $SCRATCH_MNT -w -n 3000 >> $seqres.full
+ _run_fsstress -f setattr=0 -d $SCRATCH_MNT -w -n 3000
sync
# Save the fssum of this fs
@@ -49,8 +49,8 @@ run_send_test()
# Use a single process so that in case of failure it's easier to
# reproduce by using the same seed (logged in $seqres.full).
- run_check $FSSTRESS_PROG -d $SCRATCH_MNT -p 1 -n $((LOAD_FACTOR * 200)) \
- -w $FSSTRESS_AVOID -x "$snapshot_cmd"
+ _run_fsstress -d $SCRATCH_MNT -p 1 -n $((LOAD_FACTOR * 200)) \
+ -w -x "$snapshot_cmd"
$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/snap2 \
>> $seqres.full
@@ -31,7 +31,7 @@ workload()
# Use nodatasum mount option, so all data won't have checksum.
_scratch_mount -o nodatasum
- $FSSTRESS_PROG -p 10 -n 200 -d $SCRATCH_MNT >> $seqres.full
+ _run_fsstress -p 10 -n 200 -d $SCRATCH_MNT
sync
# Generate fssum for later verification, here we only care
@@ -28,8 +28,7 @@ _basic_test()
$BTRFS_UTIL_PROG qgroup show $units $SCRATCH_MNT | grep $subvolid >> \
$seqres.full 2>&1
[ $? -eq 0 ] || _fail "couldn't find our subvols quota group"
- run_check $FSSTRESS_PROG -d $SCRATCH_MNT/a -w -p 1 -n 2000 \
- $FSSTRESS_AVOID
+ _run_fsstress -d $SCRATCH_MNT/a -w -p 1 -n 2000
_btrfs subvolume snapshot $SCRATCH_MNT/a \
$SCRATCH_MNT/b
@@ -55,8 +54,7 @@ _rescan_test()
_btrfs subvolume create $SCRATCH_MNT/a
_btrfs quota enable $SCRATCH_MNT/a
subvolid=$(_btrfs_get_subvolid $SCRATCH_MNT a)
- run_check $FSSTRESS_PROG -d $SCRATCH_MNT/a -w -p 1 -n 2000 \
- $FSSTRESS_AVOID
+ _run_fsstress -d $SCRATCH_MNT/a -w -p 1 -n 2000
sync
output=$($BTRFS_UTIL_PROG qgroup show $units $SCRATCH_MNT | grep "0/$subvolid")
echo "qgroup values before rescan: $output" >> $seqres.full
@@ -32,7 +32,7 @@ d1=$SCRATCH_MNT/d1
d2=$SCRATCH_MNT/d2
mkdir $d1
mkdir $d2
-run_check $FSSTRESS_PROG -d $d1 -w -n 2000 $FSSTRESS_AVOID
+_run_fsstress -d $d1 -w -n 2000
fssum_pre=$($FSSUM_PROG -A $SCRATCH_MNT)
# enable squotas
@@ -45,7 +45,7 @@ fssum_post=$($FSSUM_PROG -A $SCRATCH_MNT)
|| echo "fssum $fssum_pre does not match $fssum_post after enabling squota"
# do some more stuff
-run_check $FSSTRESS_PROG -d $d2 -w -n 2000 $FSSTRESS_AVOID
+_run_fsstress -d $d2 -w -n 2000
fssum_pre=$($FSSUM_PROG -A $SCRATCH_MNT)
_scratch_unmount
_check_btrfs_filesystem $SCRATCH_DEV
@@ -12,6 +12,7 @@ _begin_fstest auto dump
# Override the default cleanup function.
_cleanup()
{
+ _kill_fsstress
cd /
rm -f $tmp.*
# remove the generated data, which is much and meaningless.
@@ -29,8 +30,7 @@ workout()
echo "Run fsstress" >> $seqres.full
args=`_scale_fsstress_args -z -f creat=5 -f write=20 -f mkdir=5 -n 100 -p 15 -d $dump_dir`
echo "fsstress $args" >> $seqres.full
-
- $FSSTRESS_PROG $args >> $seqres.full 2>&1
+ _run_fsstress $args
echo "start Dump/Restore" >> $seqres.full
cd $TEST_DIR
@@ -8,15 +8,6 @@
. ./common/preamble
_begin_fstest auto ioctl
-# Override the default cleanup function.
-_cleanup()
-{
- cd /
- rm -r -f $tmp.*
- kill -9 $fsstress_pid 2>/dev/null;
- wait > /dev/null 2>&1
-}
-
# Import common functions.
. ./common/filter
@@ -41,8 +32,7 @@ _scratch_mount
# Begin fsstress while modifying UUID
fsstress_args=$(_scale_fsstress_args -d $SCRATCH_MNT -p 15 -n 999999)
-$FSSTRESS_PROG $fsstress_args >> $seqres.full &
-fsstress_pid=$!
+_run_fsstress_bg $fsstress_args
for n in $(seq 1 20); do
new_uuid=$($UUIDGEN_PROG)
@@ -57,6 +47,8 @@ for n in $(seq 1 20); do
fi
done
+_kill_fsstress
+
# success, all done
echo "Silence is golden"
status=0
@@ -13,7 +13,6 @@
. ./common/preamble
_begin_fstest auto quick
-
_supported_fs ext4
_fixed_by_kernel_commit a08f789d2ab5 \
"ext4: fix bug_on ext4_mb_use_inode_pa"
@@ -23,7 +22,7 @@ _require_scratch
_scratch_mkfs -g 256 >> $seqres.full 2>&1 || _fail "mkfs failed"
_scratch_mount
-$FSSTRESS_PROG -d $SCRATCH_MNT/stress -n 1000 >> $seqres.full 2>&1
+_run_fsstress -d $SCRATCH_MNT/stress -n 1000
echo "Silence is golden"
@@ -19,9 +19,9 @@ _workout()
echo ""
echo "Run fsstress"
out=$SCRATCH_MNT/fsstress.$$
- args=`_scale_fsstress_args -p4 -n999 -f setattr=1 $FSSTRESS_AVOID -d $out`
+ args=`_scale_fsstress_args -p4 -n999 -f setattr=1 -d $out`
echo "fsstress $args" >> $seqres.full
- $FSSTRESS_PROG $args >> $seqres.full
+ _run_fsstress $args
find $out -type f > $out.list
cat $out.list | xargs md5sum > $out.md5sum
usage=`du -sch $out | tail -n1 | gawk '{ print $1 }'`
@@ -9,18 +9,6 @@
. ./common/preamble
_begin_fstest other ioctl udf auto quick
-status=0 # success is the default!
-
-# Override the default cleanup function.
-_cleanup()
-{
- cd /
- # we might get here with a RO FS
- _test_cycle_mount
- # now remove fsstress directory.
- rm -rf $TEST_DIR/fsstress.$$.*
-}
-
# Import common functions.
. ./common/filter
@@ -30,7 +18,7 @@ _do_test()
_param="$2"
_count="$3"
- out=$TEST_DIR/fsstress.$$.$_n
+ out=$TEST_DIR/fsstress.$seq.$_n
rm -rf $out
if ! mkdir $out
then
@@ -44,9 +32,8 @@ _do_test()
echo "fsstress.$_n : $_param"
echo "-----------------------------------------------"
# -m limits number of users/groups so check doesn't fail (malloc) later
- dbgoutfile=$seqres.full
- if ! $FSSTRESS_PROG $_param $FSSTRESS_AVOID -v -m 8 -n $_count -d $out >>$dbgoutfile 2>&1
- then
+ _run_fsstress $_param -v -m 8 -n $_count -d $out
+ if [ $? -ne 0 ]; then
echo " fsstress (count=$_count) returned $? - see $seqres.full"
echo "--------------------------------------" >>$seqres.full
echo "$_n - output from fsstress:" >>$seqres.full
@@ -62,6 +49,7 @@ _do_test()
_require_test
echo "brevity is wit..."
+status=0
count=1000
procs=20
@@ -80,7 +68,7 @@ _do_test 2 "-p $procs -r" $count
_do_test 3 "-p 4 -z -f rmdir=10 -f link=10 -f creat=10 -f mkdir=10 -f rename=30 -f stat=30 -f unlink=30 -f truncate=20" $count
-# if all ok by here then probably don't need $seqres.full
+rm -rf $TEST_DIR/fsstress.$seq.*
exit
@@ -22,7 +22,9 @@ _require_fail_make_request
# Override the default cleanup function.
_cleanup()
{
- kill $fs_pid $fio_pid &> /dev/null
+ _kill_fsstress
+ kill $fio_pid &> /dev/null
+ wait
_disallow_fail_make_request
cd /
rm -r -f $tmp.*
@@ -85,13 +87,12 @@ FSSTRESS_AVOID="$FSSTRESS_AVOID -ffsync=0 -fsync=0 -ffdatasync=0 -f setattr=1"
_workout()
{
out=$SCRATCH_MNT/fsstress.$$
- args=`_scale_fsstress_args -p 1 -n999999999 -f setattr=0 $FSSTRESS_AVOID -d $out`
+ args=`_scale_fsstress_args -p 1 -n999999999 -f setattr=0 -d $out`
echo ""
echo "Start fsstress.."
echo ""
echo "fsstress $args" >> $seqres.full
- $FSSTRESS_PROG $args >> $seqres.full 2>&1 &
- fs_pid=$!
+ _run_fsstress_bg $args
echo "Start fio.."
cat $fio_config >> $seqres.full
$FIO_PROG $fio_config >> $seqres.full 2>&1 &
@@ -107,10 +108,8 @@ _workout()
>> $seqres.full 2>&1 && \
_fail "failed: still able to perform integrity fsync on $SCRATCH_MNT"
- kill $fs_pid &> /dev/null
- wait $fs_pid
+ _kill_fsstress
wait $fio_pid
- unset fs_pid
unset fio_pid
# We expect that broken FS still can be umounted
@@ -14,18 +14,8 @@ _begin_fstest shutdown auto stress log metadata repair
# Import common functions.
. ./common/filter
-# Override the default cleanup function.
-_cleanup()
-{
- cd /
- _scratch_unmount 2>/dev/null
- rm -f $tmp.*
-}
-
-
_require_scratch
_require_scratch_shutdown
-_require_command "$KILLALL_PROG" killall
_scratch_mkfs > $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
@@ -37,25 +27,23 @@ PROCS=$((2 * LOAD_FACTOR))
load_dir=$SCRATCH_MNT/test
# let this run for a while
-$FSSTRESS_PROG $FSSTRESS_AVOID -n10000000 -p $PROCS -d $load_dir >> $seqres.full 2>&1 &
+_run_fsstress_bg -n 10000000 -p $PROCS -d $load_dir
sleep $SLEEP_TIME
-$KILLALL_PROG -q $FSSTRESS_PROG
-wait
+_kill_fsstress
sync
_scratch_unmount
# 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 &
+_run_fsstress_bg -n10000000 -p $PROCS -d $load_dir
sleep $SLEEP_TIME
sync
# now shutdown and unmount
sleep 5
_scratch_shutdown
-$KILLALL_PROG -q $FSSTRESS_PROG
-wait
+_kill_fsstress
# for some reason fsstress processes manage to live on beyond the wait?
sleep 5
@@ -23,9 +23,9 @@ _do_meta()
param="-p 4 -z -f rmdir=10 -f link=10 -f creat=10 -f mkdir=10 \
-f rename=30 -f stat=30 -f unlink=30 -f truncate=20"
_echofull "calling fsstress $param -m8 -n $count"
- FSSTRESS_ARGS=`_scale_fsstress_args $param $FSSTRESS_AVOID -m 8 -n $count -d $out`
- if ! $FSSTRESS_PROG $FSSTRESS_ARGS >>$seqres.full 2>&1
- then
+ FSSTRESS_ARGS=`_scale_fsstress_args $param -m 8 -n $count -d $out`
+ _run_fsstress $FSSTRESS_ARGS
+ if [ $? -ne 0 ]; then
_echofull "fsstress failed"
fi
}
@@ -19,8 +19,7 @@ _cleanup()
{
# Make sure $SCRATCH_MNT is unfreezed
xfs_freeze -u $SCRATCH_MNT 2>/dev/null
- [ -n "$pid" ] && kill -9 $pid 2>/dev/null
- wait $pid
+ _kill_fsstress
cd /
rm -f $tmp.*
}
@@ -54,8 +53,8 @@ touch $tmp.running
do
# 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 >>$seqres.full
+ FSSTRESS_ARGS=`_scale_fsstress_args -d $STRESS_DIR -p $procs -n $nops`
+ _run_fsstress $FSSTRESS_ARGS >>$seqres.full
done
rm -r $STRESS_DIR/*
@@ -9,19 +9,10 @@
. ./common/preamble
_begin_fstest attr udf auto quick stress
-# Override the default cleanup function.
-_cleanup()
-{
- cd /
- rm -rf $TEST_DIR/fsstress
- rm -f $tmp.*
-}
-
# Import common functions.
. ./common/filter
. ./common/attr
-
_require_test
_require_attrs
@@ -34,7 +25,8 @@ FSSTRESS_ARGS=`_scale_fsstress_args \
-f attr_set=100 \
-f attr_remove=100 \
-p 1 -n 10000 -S c`
-$FSSTRESS_PROG $FSSTRESS_ARGS >$seqres.full 2>&1
+_run_fsstress $FSSTRESS_ARGS
+rm -rf $TEST_DIR/fsstress
status=$?
exit
@@ -21,16 +21,14 @@ _lets_get_pidst()
# Override the default cleanup function.
_cleanup()
{
- echo "*** unmount"
- _scratch_unmount 2>/dev/null
_lets_get_pidst
+ cd /
+ rm -f $tmp.*
}
-_register_cleanup "_cleanup; rm -f $tmp.*"
# Import common functions.
. ./common/filter
-
_require_scratch
_require_local_device $SCRATCH_DEV
@@ -48,9 +46,9 @@ echo "*** test concurrent block/fs access"
cat $SCRATCH_DEV >/dev/null &
pid=$!
-FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -p 2 -n 2000 $FSSTRESS_AVOID`
+FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -p 2 -n 2000`
echo "run fsstress with args: $FSSTRESS_ARGS" >>$seqres.full
-$FSSTRESS_PROG $FSSTRESS_ARGS >>$seqres.full
+_run_fsstress $FSSTRESS_ARGS
_lets_get_pidst
echo "*** done"
@@ -2,4 +2,3 @@ QA output created by 076
*** init fs
*** test concurrent block/fs access
*** done
-*** unmount
@@ -18,18 +18,9 @@
. ./common/preamble
_begin_fstest rw auto enospc stress
-# Override the default cleanup function.
-_cleanup()
-{
- echo "*** unmount"
- _scratch_unmount 2>/dev/null
- rm -f $tmp.*
-}
-
# Import common functions.
. ./common/filter
-
_require_scratch
_require_no_large_scratch_dev
@@ -52,8 +43,8 @@ workout()
_scratch_mount
# -w ensures that the only ops are ones which cause write I/O
- FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs -n $nops $FSSTRESS_AVOID`
- $FSSTRESS_PROG $FSSTRESS_ARGS >>$seqres.full
+ FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs -n $nops`
+ _run_fsstress $FSSTRESS_ARGS >>$seqres.full
}
echo "*** test out-of-space handling for random write operations"
@@ -1,4 +1,3 @@
QA output created by 083
*** test out-of-space handling for random write operations
*** done
-*** unmount
@@ -63,9 +63,7 @@ echo Running fsstress in serial:
i=0
while [ $i -lt $ITERATIONS ]; do
echo fsstress iteration: $i | tee -a $seqres.full
- $FSSTRESS_PROG \
- -d $SCRATCH_MNT/fsstress \
- $fss_ops -S c >>$seqres.full 2>&1
+ _run_fsstress -d $SCRATCH_MNT/fsstress $fss_ops -S c
let i=$i+1
done
@@ -30,13 +30,12 @@ _fsstress()
out=$SCRATCH_MNT/fsstress.$$
count=2000
- args=`_scale_fsstress_args -d $out -n $count -p 7 $FSSTRESS_AVOID`
+ args=`_scale_fsstress_args -d $out -n $count -p 7`
echo "fsstress $args" >> $seqres.full
- if ! $FSSTRESS_PROG $args | tee -a $seqres.full | _filter_num
+ if ! _run_fsstress $args
then
echo " fsstress $args returned $?"
- cat $tmp.out | tee -a $seqres.full
status=1
fi
}
@@ -2,6 +2,5 @@ QA output created by 232
Testing fsstress
-seed = S
Comparing user usage
Comparing group usage
@@ -21,10 +21,9 @@ _workout()
num_iterations=10
enospc_time=2
out=$SCRATCH_MNT/fsstress.$$
- args=`_scale_fsstress_args -p128 -n999999999 -f setattr=1 $FSSTRESS_AVOID -d $out`
+ args=`_scale_fsstress_args -p128 -n999999999 -f setattr=1 -d $out`
echo "fsstress $args" >> $seqres.full
- $FSSTRESS_PROG $args &>> $seqres.full &
- pid=$!
+ _run_fsstress_bg $args
echo "Run dd writers in parallel"
for ((i=0; i < num_iterations; i++))
do
@@ -34,8 +33,7 @@ _workout()
sleep $enospc_time
done
echo "Killing fsstress process..." >> $seqres.full
- kill $pid >> $seqres.full 2>&1
- wait $pid
+ _kill_fsstress
}
_require_scratch
@@ -28,8 +28,8 @@ _workout()
args=`_scale_fsstress_args -p128 -n999999999 -f setattr=1 $FSSTRESS_AVOID -d $out`
echo "fsstress $args" >> $seqres.full
# Grant chown capability
- cp $FSSTRESS_PROG $tmp.fsstress.bin
- $SETCAP_PROG cap_chown=epi $tmp.fsstress.bin
+ cp $FSSTRESS_PROG $_FSSTRESS_PROG
+ $SETCAP_PROG cap_chown=epi $_FSSTRESS_PROG
# io_uring accounts memory it needs under the rlimit memlocked option,
# which can be quite low on some setups (especially 64K pagesize). root
@@ -37,7 +37,8 @@ _workout()
# io_uring_queue_init fail on ENOMEM, set max locked memory to unlimited
# temporarily.
ulimit -l unlimited
- (su $qa_user -c "$tmp.fsstress.bin $args" &) > /dev/null 2>&1
+ su $qa_user -c "$_FSSTRESS_PROG $args" > /dev/null 2>&1 &
+ _FSSTRESS_PID=$!
echo "Run dd writers in parallel"
for ((i=0; i < num_iterations; i++))
@@ -49,7 +50,7 @@ _workout()
sleep $enospc_time
done
- $KILLALL_PROG -w $tmp.fsstress.bin
+ _kill_fsstress
}
_require_quota
@@ -17,23 +17,9 @@
. ./common/preamble
_begin_fstest shutdown auto log metadata recoveryloop
-# Override the default cleanup function.
-_cleanup()
-{
- cd /
- rm -f $tmp.*
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
- _scratch_unmount > /dev/null 2>&1
-}
-
-# Import common functions.
-
-# Modify as appropriate.
-
_require_scratch
_require_local_device $SCRATCH_DEV
_require_scratch_shutdown
-_require_command "$KILLALL_PROG" "killall"
echo "Silence is golden."
@@ -42,20 +28,14 @@ _require_metadata_journaling $SCRATCH_DEV
_scratch_mount
while _soak_loop_running $((50 * TIME_FACTOR)); do
- ($FSSTRESS_PROG $FSSTRESS_AVOID -d $SCRATCH_MNT -n 999999 -p 4 >> $seqres.full &) \
- > /dev/null 2>&1
+ _run_fsstress_bg -d $SCRATCH_MNT -n 999999 -p 4
# purposely include 0 second sleeps to test shutdown immediately after
# recovery
sleep $((RANDOM % 3))
_scratch_shutdown
- ps -e | grep fsstress > /dev/null 2>&1
- while [ $? -eq 0 ]; do
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
- wait > /dev/null 2>&1
- ps -e | grep fsstress > /dev/null 2>&1
- done
+ _kill_fsstress
# Toggle between rw and ro mounts for recovery. Quit if any mount
# attempt fails so we don't shutdown the host fs.
@@ -18,8 +18,7 @@ _cleanup()
[ -n "$freeze_pids" ] && kill -9 $freeze_pids 2>/dev/null
wait $freeze_pids
xfs_freeze -u $SCRATCH_MNT 2>/dev/null
- [ -n "$fsstress_pid" ] && kill -9 $fsstress_pid 2>/dev/null
- wait $fsstress_pid
+ _kill_fsstress
rm -f $tmp.*
}
@@ -49,9 +48,8 @@ fi
nops=1000
stress_dir="$SCRATCH_MNT/fsstress_test_dir"
mkdir "$stress_dir"
-fsstress_args=`_scale_fsstress_args -d $stress_dir -p $procs -n $nops $FSSTRESS_AVOID`
-$FSSTRESS_PROG $fsstress_args >>$seqres.full 2>&1 &
-fsstress_pid=$!
+fsstress_args=`_scale_fsstress_args -d $stress_dir -p $procs -n $nops`
+_run_fsstress_bg $fsstress_args
# Start multi-threads freeze/unfreeze
for ((i=0; i<$procs; i++)); do
@@ -62,9 +60,8 @@ for ((i=0; i<$procs; i++)); do
freeze_pids="$! $freeze_pids"
done
-wait $fsstress_pid
+_wait_for_fsstress
result=$?
-unset fsstress_pid
wait $freeze_pids
unset freeze_pids
@@ -25,11 +25,12 @@ _begin_fstest auto quick mount
# Override the default cleanup function.
_cleanup()
{
- cd /
- rm -f $tmp.*
+ _kill_fsstress
_clear_mount_stack
# make sure there's no bug cause dentry isn't be freed
rm -rf $MNTHEAD
+ cd /
+ rm -f $tmp.*
}
# Import common functions.
@@ -43,7 +44,7 @@ fs_stress()
{
local target=$1
- $FSSTRESS_PROG -z -n 50 -p 3 \
+ _run_fsstress -z -n 50 -p 3 \
-f creat=5 \
-f mkdir=5 \
-f link=2 \
@@ -56,7 +57,7 @@ fs_stress()
-f chown=1 \
-f getdents=1 \
-f fiemap=1 \
- -d $target >>$seqres.full
+ -d $target
sync
}
@@ -33,11 +33,12 @@ _begin_fstest auto quick mount
# Override the default cleanup function.
_cleanup()
{
- cd /
- rm -f $tmp.*
+ _kill_fsstress
_clear_mount_stack
# make sure there's no bug cause dentry isn't be freed
rm -rf $MNTHEAD
+ cd /
+ rm -f $tmp.*
}
# Import common functions.
@@ -51,7 +52,7 @@ fs_stress()
{
local target=$1
- $FSSTRESS_PROG -z -n 50 -p 3 \
+ _run_fsstress -z -n 50 -p 3 \
-f creat=5 \
-f mkdir=5 \
-f link=2 \
@@ -64,7 +65,7 @@ fs_stress()
-f chown=1 \
-f getdents=1 \
-f fiemap=1 \
- -d $target >>$seqres.full
+ -d $target
sync
}
@@ -14,11 +14,12 @@ _begin_fstest auto quick mount
# Override the default cleanup function.
_cleanup()
{
- cd /
- rm -f $tmp.*
+ _kill_fsstress
_clear_mount_stack
# make sure there's no bug cause dentry isn't be freed
rm -rf $MNTHEAD
+ cd /
+ rm -f $tmp.*
}
# Import common functions.
@@ -32,7 +33,7 @@ fs_stress()
{
local target=$1
- $FSSTRESS_PROG -z -n 500 -p 5 \
+ _run_fsstress -z -n 500 -p 5 \
-f creat=5 \
-f mkdir=5 \
-f dwrite=1 \
@@ -47,7 +48,7 @@ fs_stress()
-f chown=1 \
-f getdents=1 \
-f fiemap=1 \
- -d $target >>$seqres.full
+ -d $target
sync
}
@@ -14,18 +14,8 @@ _begin_fstest auto shutdown stress
# Import common functions.
. ./common/filter
-# Override the default cleanup function.
-_cleanup()
-{
- cd /
- _scratch_unmount 2>/dev/null
- rm -f $tmp.*
-}
-
-
_require_scratch_nocheck
_require_scratch_shutdown
-_require_command "$KILLALL_PROG" killall
_scratch_mkfs > $seqres.full 2>&1
_scratch_mount
@@ -35,15 +25,14 @@ PROCS=$((4 * LOAD_FACTOR))
load_dir=$SCRATCH_MNT/test
-$FSSTRESS_PROG $FSSTRESS_AVOID -n10000000 -p $PROCS -d $load_dir >> $seqres.full 2>&1 &
+_run_fsstress_bg -n10000000 -p $PROCS -d $load_dir
sleep $SLEEP_TIME
sync
# now shutdown and unmount
sleep 5
_scratch_shutdown
-$KILLALL_PROG -q $FSSTRESS_PROG
-wait
+_kill_fsstress
# for some reason fsstress processes manage to live on beyond the wait?
sleep 5
@@ -17,11 +17,11 @@ _begin_fstest shutdown auto log metadata eio recoveryloop smoketest
# Override the default cleanup function.
_cleanup()
{
- cd /
- rm -f $tmp.*
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
+ _kill_fsstress
_dmerror_unmount
_dmerror_cleanup
+ cd /
+ rm -f $tmp.*
}
# Import common functions.
@@ -31,7 +31,6 @@ _cleanup()
_require_scratch
_require_dm_target error
-_require_command "$KILLALL_PROG" "killall"
echo "Silence is golden."
@@ -41,8 +40,7 @@ _dmerror_init
_dmerror_mount
while _soak_loop_running $((50 * TIME_FACTOR)); do
- ($FSSTRESS_PROG $FSSTRESS_AVOID -d $SCRATCH_MNT -n 999999 -p $((LOAD_FACTOR * 4)) >> $seqres.full &) \
- > /dev/null 2>&1
+ _run_fsstress_bg -d $SCRATCH_MNT -n 999999 -p $((LOAD_FACTOR * 4))
# purposely include 0 second sleeps to test shutdown immediately after
# recovery
@@ -55,12 +53,7 @@ while _soak_loop_running $((50 * TIME_FACTOR)); do
# error table helper *without* 'lockfs'.
_dmerror_load_error_table
- ps -e | grep fsstress > /dev/null 2>&1
- while [ $? -eq 0 ]; do
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
- wait > /dev/null 2>&1
- ps -e | grep fsstress > /dev/null 2>&1
- done
+ _kill_fsstress
# Mount again to replay log after loading working table, so we have a
# consistent XFS after test.
@@ -10,20 +10,7 @@
. ./common/preamble
_begin_fstest auto rw long_rw stress soak smoketest
-# Override the default cleanup function.
-_cleanup()
-{
- cd /
- rm -f $tmp.*
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
-}
-
-# Import common functions.
-
-# Modify as appropriate.
-
_require_scratch
-_require_command "$KILLALL_PROG" "killall"
echo "Silence is golden."
@@ -35,7 +22,7 @@ nr_ops=$((25000 * nr_cpus * TIME_FACTOR))
fsstress_args=(-w -d $SCRATCH_MNT -n $nr_ops -p $nr_cpus)
test -n "$SOAK_DURATION" && fsstress_args+=(--duration="$SOAK_DURATION")
-$FSSTRESS_PROG $FSSTRESS_AVOID "${fsstress_args[@]}" >> $seqres.full
+_run_fsstress_bg "${fsstress_args[@]}"
# success, all done
status=0
@@ -18,10 +18,10 @@ _begin_fstest auto metadata replay thin recoveryloop
# failure leaves the corpse intact for post-mortem failure analysis.
_cleanup()
{
- cd /
- $KILLALL_PROG -KILL -q $FSSTRESS_PROG &> /dev/null
+ _kill_fsstress
_log_writes_cleanup &> /dev/null
_dmthin_cleanup
+ cd /
rm -f $tmp.*
}
@@ -29,7 +29,7 @@ _cleanup()
#_cleanup()
#{
# cd /
-# $KILLALL_PROG -KILL -q $FSSTRESS_PROG &> /dev/null
+# [ -n "$fsstress_pid" ] && kill $fsstress_pid
# if [ $status -eq 0 ]; then
# _log_writes_cleanup &> /dev/null
# _dmthin_cleanup
@@ -48,7 +48,6 @@ _cleanup()
# Modify as appropriate.
_require_no_logdev
-_require_command "$KILLALL_PROG" killall
# Use thin device as replay device, which requires $SCRATCH_DEV
_require_scratch_nocheck
# and we need extra device as log device
@@ -60,8 +59,7 @@ nr_cpus=$("$here/src/feature" -o)
if [ $nr_cpus -gt 8 ]; then
nr_cpus=8
fi
-fsstress_args=$(_scale_fsstress_args -w -d $SCRATCH_MNT -n 512 -p $nr_cpus \
- $FSSTRESS_AVOID)
+fsstress_args=$(_scale_fsstress_args -w -d $SCRATCH_MNT -n 512 -p $nr_cpus)
size=$(_small_fs_size_mb 200) # 200m phys/virt size
devsize=$((1024*1024*size / 512))
@@ -77,7 +75,7 @@ _log_writes_mkfs >> $seqres.full 2>&1
_log_writes_mark mkfs
_log_writes_mount
-run_check $FSSTRESS_PROG $fsstress_args
+_run_fsstress $fsstress_args
_log_writes_unmount
_log_writes_remove
@@ -14,6 +14,7 @@ _begin_fstest auto quick log
# Override the default cleanup function.
_cleanup()
{
+ _kill_fsstress
_cleanup_flakey
cd /
rm -f $tmp.*
@@ -38,10 +39,10 @@ _init_flakey
_mount_flakey
mkdir $SCRATCH_MNT/test
-args=`_scale_fsstress_args -p 4 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/test`
+args=`_scale_fsstress_args -p 4 -n 100 -d $SCRATCH_MNT/test`
args="$args -f mknod=0 -f symlink=0"
echo "Running fsstress with arguments: $args" >>$seqres.full
-$FSSTRESS_PROG $args >>$seqres.full
+_run_fsstress $args
# Fsync every file and directory.
find $SCRATCH_MNT/test \( -type f -o -type d \) -exec $XFS_IO_PROG -c fsync {} \;
@@ -30,8 +30,8 @@ function iterate_dedup_verify()
find $dest -type f -exec md5sum {} \; \
> $md5file$index
# Make some noise
- $FSSTRESS_PROG $fsstress_opts -d $noisedir \
- -n 200 -p $((5 * LOAD_FACTOR)) >/dev/null 2>&1
+ _run_fsstress $fsstress_opts -d $noisedir \
+ -n 200 -p $((5 * LOAD_FACTOR))
# Too many output, so only save error output
$DUPEREMOVE_PROG -dr --dedupe-options=same $dupdir \
>/dev/null 2>$seqres.full
@@ -51,8 +51,7 @@ md5file=${tmp}.md5sum
fsstress_opts="-w -r"
# Create some files to be original data
-$FSSTRESS_PROG $fsstress_opts -d $srcdir \
- -n 500 -p $((5 * LOAD_FACTOR)) >/dev/null 2>&1
+_run_fsstress $fsstress_opts -d $srcdir -n 500 -p $((5 * LOAD_FACTOR))
# Calculate how many test cycles will be run
src_size=`du -ks $srcdir | awk '{print $1}'`
@@ -13,9 +13,9 @@ _begin_fstest auto stress dedupe
# Override the default cleanup function.
_cleanup()
{
+ end_test
cd /
rm -f $tmp.*
- end_test
}
# Import common functions.
@@ -23,28 +23,20 @@ _cleanup()
. ./common/reflink
_require_scratch_duperemove
-_require_command "$KILLALL_PROG" killall
_scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
function end_test()
{
- local f=1
+ _kill_fsstress
# stop duperemove running
if [ -e $dupe_run ]; then
rm -f $dupe_run
- $KILLALL_PROG -q $DUPEREMOVE_PROG > /dev/null 2>&1
+ kill $dedup_pids
wait $dedup_pids
fi
-
- # Make sure all fsstress get killed
- while [ $f -ne 0 ]; do
- $KILLALL_PROG -q $FSSTRESS_PROG > /dev/null 2>&1
- sleep 1
- f=`ps -eLf | grep $FSSTRESS_PROG | grep -v "grep" | wc -l`
- done
}
sleep_time=$((50 * TIME_FACTOR))
@@ -53,7 +45,8 @@ sleep_time=$((50 * TIME_FACTOR))
testdir="$SCRATCH_MNT/dir"
mkdir $testdir
fsstress_opts="-r -n 1000 -p $((5 * LOAD_FACTOR))"
-$FSSTRESS_PROG $fsstress_opts -d $testdir -l 0 >> $seqres.full 2>&1 &
+_run_fsstress_bg $fsstress_opts -d $testdir -l 0
+
dedup_pids=""
dupe_run=$TEST_DIR/${seq}-running
# Start several dedupe processes on same directory
@@ -16,7 +16,7 @@ _begin_fstest auto stress verity
_cleanup()
{
# Stop all subprocesses.
- $KILLALL_PROG -q $FSSTRESS_PROG
+ _kill_fsstress
touch $tmp.done
wait
@@ -29,7 +29,6 @@ _cleanup()
. ./common/verity
_require_scratch_verity
-_require_command "$KILLALL_PROG" killall
_disable_fsverity_signatures
_scratch_mkfs_verity &>> $seqres.full
@@ -92,8 +91,7 @@ done
) &
# Start the fsstress processes.
-$FSSTRESS_PROG $FSSTRESS_AVOID -p $nproc_stress -l 0 -d $SCRATCH_MNT/stressdir \
- >> $seqres.full 2>&1 &
+_run_fsstress_bg -p $nproc_stress -l 0 -d $SCRATCH_MNT/stressdir
# Run for a while.
sleep $runtime
@@ -23,10 +23,10 @@ _scratch_mount >> $seqres.full 2>&1
# start a create and rename(rename_whiteout) workload. These processes
# occur simultaneously may cause the deadlock between AGI and AGF with
# RENAME_WHITEOUT.
-$FSSTRESS_PROG -z -n 150 -p 100 \
+_run_fsstress -z -n 150 -p 100 \
-f mknod=5 \
-f rwhiteout=5 \
- -d $SCRATCH_MNT/fsstress >> $seqres.full 2>&1
+ -d $SCRATCH_MNT/fsstress
echo Silence is golden
@@ -28,11 +28,12 @@ _begin_fstest auto mount
# Override the default cleanup function.
_cleanup()
{
- cd /
- rm -f $tmp.*
+ _kill_fsstress
_clear_mount_stack
# make sure there's no bug cause dentry isn't be freed
rm -rf $MNTHEAD
+ cd /
+ rm -f $tmp.*
}
# Import common functions.
@@ -46,7 +47,7 @@ fs_stress()
{
local target=$1
- $FSSTRESS_PROG -n 50 -p 3 -d $target >>$seqres.full
+ _run_fsstress -n 50 -p 3 -d $target
sync
}
@@ -10,17 +10,9 @@
. ./common/preamble
_begin_fstest auto soak attr long_rw stress smoketest
-_cleanup()
-{
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
- cd /
- rm -f $tmp.*
-}
-
# Modify as appropriate.
_require_scratch
-_require_command "$KILLALL_PROG" "killall"
echo "Silence is golden."
@@ -50,7 +42,7 @@ args+=('-f' "setfattr=20")
args+=('-f' "attr_set=60") # sets larger xattrs
test -n "$SOAK_DURATION" && args+=(--duration="$SOAK_DURATION")
-$FSSTRESS_PROG "${args[@]}" $FSSTRESS_AVOID -d $SCRATCH_MNT -n $nr_ops -p $nr_cpus >> $seqres.full
+_run_fsstress "${args[@]}" -d $SCRATCH_MNT -n $nr_ops -p $nr_cpus
# success, all done
status=0
@@ -16,16 +16,15 @@ _begin_fstest shutdown auto log metadata eio recoveryloop
_cleanup()
{
- cd /
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
- wait
+ _kill_fsstress
if [ -n "$loopmnt" ]; then
$UMOUNT_PROG $loopmnt 2>/dev/null
rm -r -f $loopmnt
fi
- rm -f $tmp.*
_dmerror_unmount
_dmerror_cleanup
+ cd /
+ rm -f $tmp.*
}
# Import common functions.
@@ -37,7 +36,6 @@ _cleanup()
_require_scratch_reflink
_require_cp_reflink
_require_dm_target error
-_require_command "$KILLALL_PROG" "killall"
_require_loop
echo "Silence is golden."
@@ -71,8 +69,6 @@ snap_loop_fs() {
rm -f "$snap_aliveflag"
}
-fsstress=($FSSTRESS_PROG $FSSTRESS_AVOID -d "$loopmnt" -n 999999 -p "$((LOAD_FACTOR * 4))")
-
while _soak_loop_running $((25 * TIME_FACTOR)); do
touch $scratch_aliveflag
snap_loop_fs >> $seqres.full 2>&1 &
@@ -84,7 +80,7 @@ while _soak_loop_running $((25 * TIME_FACTOR)); do
break
fi
- ("${fsstress[@]}" >> $seqres.full &) > /dev/null 2>&1
+ _run_fsstress_bg -d "$loopmnt" -n 999999 -p "$((LOAD_FACTOR * 4))"
# purposely include 0 second sleeps to test shutdown immediately after
# recovery
@@ -98,12 +94,7 @@ while _soak_loop_running $((25 * TIME_FACTOR)); do
# error table helper *without* 'lockfs'.
_dmerror_load_error_table
- ps -e | grep fsstress > /dev/null 2>&1
- while [ $? -eq 0 ]; do
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
- wait > /dev/null 2>&1
- ps -e | grep fsstress > /dev/null 2>&1
- done
+ _kill_fsstress
for ((j = 0; j < 10; j++)); do
test -e "$snap_aliveflag" || break
sleep 1
@@ -16,14 +16,14 @@ _begin_fstest auto rw stress soak
# Override the default cleanup function.
_cleanup()
{
- cd /
- rm -f $tmp.*
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
+ _kill_fsstress
wait # for exercise_cpu_hotplug subprocess
for i in "$sysfs_cpu_dir/"cpu*/online; do
echo 1 > "$i" 2>/dev/null
done
test -n "$stress_dir" && rm -r -f "$stress_dir"
+ cd /
+ rm -f $tmp.*
}
exercise_cpu_hotplug()
@@ -39,7 +39,6 @@ exercise_cpu_hotplug()
}
_require_test
-_require_command "$KILLALL_PROG" "killall"
sysfs_cpu_dir="/sys/devices/system/cpu"
@@ -71,13 +70,17 @@ test "$nr_cpus" -gt 1024 && nr_cpus="$nr_hotplug_cpus"
fsstress_args+=(-p $nr_cpus)
if [ -n "$SOAK_DURATION" ]; then
test "$SOAK_DURATION" -lt 10 && SOAK_DURATION=10
- fsstress_args+=(--duration="$((SOAK_DURATION / 10))")
+else
+ # run for 30s per iteration max
+ SOAK_DURATION=300
fi
+fsstress_args+=(--duration="$((SOAK_DURATION / 10))")
nr_ops=$((2500 * TIME_FACTOR))
fsstress_args+=(-n $nr_ops)
for ((i = 0; i < 10; i++)); do
- $FSSTRESS_PROG $FSSTRESS_AVOID -w "${fsstress_args[@]}" >> $seqres.full
+ _run_fsstress_bg -w "${fsstress_args[@]}"
+ _wait_for_fsstress
_test_cycle_mount
done
@@ -11,13 +11,12 @@ _begin_fstest auto rw long_rw stress soak smoketest
_cleanup()
{
- cd /
+ _kill_fsstress
rm -f $runfile
- rm -f $tmp.*
kill -9 $trigger_compaction_pid > /dev/null 2>&1
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
-
wait > /dev/null 2>&1
+ rm -f $tmp.*
+ cd /
}
# Import common functions.
@@ -26,7 +25,6 @@ _cleanup()
_require_scratch
_require_vm_compaction
-_require_command "$KILLALL_PROG" "killall"
# We still deadlock with this test on v6.10-rc2, we need more work.
# but the below makes things better.
@@ -52,7 +50,7 @@ while [ -e $runfile ]; do
done &
trigger_compaction_pid=$!
-$FSSTRESS_PROG $FSSTRESS_AVOID "${fsstress_args[@]}" >> $seqres.full
+_run_fsstress "${fsstress_args[@]}"
rm -f $runfile
wait > /dev/null 2>&1
@@ -16,11 +16,11 @@ _begin_fstest shutdown auto log metadata eio recoveryloop attr
# Override the default cleanup function.
_cleanup()
{
- cd /
- rm -f $tmp.*
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
+ _kill_fsstress
_dmerror_unmount
_dmerror_cleanup
+ cd /
+ rm -f $tmp.*
}
# Import common functions.
@@ -30,7 +30,6 @@ _cleanup()
_require_scratch
_require_dm_target error
-_require_command "$KILLALL_PROG" "killall"
echo "Silence is golden."
@@ -59,8 +58,7 @@ args+=('-f' "setfattr=20")
args+=('-f' "attr_set=60") # sets larger xattrs
while _soak_loop_running $((50 * TIME_FACTOR)); do
- ($FSSTRESS_PROG "${args[@]}" $FSSTRESS_AVOID -d $SCRATCH_MNT -n 999999 -p $((LOAD_FACTOR * 4)) >> $seqres.full &) \
- > /dev/null 2>&1
+ _run_fsstress_bg "${args[@]}" -d $SCRATCH_MNT -n 999999 -p $((LOAD_FACTOR * 4))
# purposely include 0 second sleeps to test shutdown immediately after
# recovery
@@ -73,12 +71,7 @@ while _soak_loop_running $((50 * TIME_FACTOR)); do
# error table helper *without* 'lockfs'.
_dmerror_load_error_table
- ps -e | grep fsstress > /dev/null 2>&1
- while [ $? -eq 0 ]; do
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
- wait > /dev/null 2>&1
- ps -e | grep fsstress > /dev/null 2>&1
- done
+ _kill_fsstress
# Mount again to replay log after loading working table, so we have a
# consistent XFS after test.
@@ -9,6 +9,22 @@
. ./common/preamble
_begin_fstest auto stress
+# This nests multiple background fsstress instances, so we have to
+# do some magic with _FSSTRESS_PID here.
+_cleanup()
+{
+ if [ -n "$fsstress_pid_1" ]; then
+ FSTRESS_PID=$fsstress_pid_1
+ _kill_fsstress
+ fi
+ if [ -n "$fsstress_pid_2" ]; then
+ FSTRESS_PID=$fsstress_pid_2
+ _kill_fsstress
+ fi
+ cd /
+ rm -f tmp.*
+}
+
# Import common functions.
. ./common/filter
@@ -28,29 +44,31 @@ d_low=$lowerdir/fsstress
d_top=$SCRATCH_MNT/fsstress
mkdir -p $d_low $d_top
-echo $FSSTRESS_PROG -s 42 -d $d_low -p 4 -n 1000 -l100 -v > $seqres.full.1
-$FSSTRESS_PROG -s 42 -d $d_low -p 4 -n 1000 -l100 -v >> $seqres.full.1 2>&1 &
+echo fsstress -s 42 -d $d_low -p 4 -n 1000 -l100 -v >> $seqres.full
+_run_fsstress_bg -s 42 -d $d_low -p 4 -n 1000 -l100 -v
+fsstress_pid_1=$_FSSTRESS_PID
-echo $FSSTRESS_PROG -s 42 -d $d_top -p 4 -n 1000 -l100 -v > $seqres.full.2
-$FSSTRESS_PROG -s 42 -d $d_top -p 4 -n 1000 -l100 -v >> $seqres.full.2 2>&1 &
+echo fsstress -s 42 -d $d_top -p 4 -n 1000 -l100 -v >> $seqres.full
+_run_fsstress_bg -s 42 -d $d_top -p 4 -n 1000 -l100 -v
+fsstress_pid_2=$_FSTRESS_PID
+unset _FSSTRESS_PID
ret=0
-if ! wait %1; then
- echo "--------------------------------------" >>$seqres.full.1
- echo "fsstress on lower directory returned $? - see $seqres.full.1"
- echo "--------------------------------------" >>$seqres.full.1
+if ! wait $fsstress_pid_1; then
+ echo "--------------------------------------" >>$seqres.full
+ echo "fsstress on lower directory returned $? - see $seqres.full"
+ echo "--------------------------------------" >>$seqres.full
ret=1
fi
+unset fsstress_pid_1
-if ! wait %2; then
- echo "--------------------------------------" >>$seqres.full.2
- echo "fsstress on overlay directory returned $? - see $seqres.full.2"
- echo "--------------------------------------" >>$seqres.full.2
+if ! wait $fsstress_pid_2; then
+ echo "--------------------------------------" >>$seqres.full
+ echo "fsstress on overlay directory returned $? - see $seqres.full"
+ echo "--------------------------------------" >>$seqres.full
ret=1
fi
-
-cat $seqres.full.1 $seqres.full.2 > $seqres.full
-rm $seqres.full.1 $seqres.full.2
+unset fsstress_pid_2
if [ "$ret" -eq 1 ]; then
status=1
@@ -33,8 +33,8 @@ d_low=$lowerdir/$testdir
mkdir -p $d_low
# Create 4K empty files in 4 directories
-echo $FSSTRESS_PROG -d $d_low -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full
-$FSSTRESS_PROG -d $d_low -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full 2>&1
+echo fsstress -d $d_low -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full
+_run_fsstress -d $d_low -p 4 -z -f creat=1 -n 1024 -v
echo "--------------------------------------" >> $seqres.full
echo "Created 1K files in lower directory. " >> $seqres.full
@@ -91,9 +91,9 @@ echo "Go team truncate!! " >> $seqres.full
# Give team 'touch' a 1 second head start.
# Team 'truncate' players should catch up after few copy up bombs.
sleep 1
-$FSSTRESS_PROG -d $d_top -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full &
+_run_fsstress -d $d_top -p 4 -z -f creat=1 -n 1024 -v
-wait %1 %2 %3 %4 %5
+wait %1 %2 %3 %4
echo "Silence is golden"
status=0
@@ -13,9 +13,10 @@ _begin_fstest auto quick mount eio
# Override the default cleanup function.
_cleanup()
{
+ _kill_fsstress
+ _dmerror_cleanup
cd /
rm -f $tmp.*
- _dmerror_cleanup
}
# Import common functions.
@@ -45,7 +46,7 @@ fi
# start a metadata-intensive workload, but no data allocation operation.
# Because uncompleted new space allocation I/Os may cause XFS to shutdown
# after loading error table.
-$FSSTRESS_PROG -z -n 5000 -p 10 \
+_run_fsstress -z -n 5000 -p 10 \
-f creat=10 \
-f resvsp=1 \
-f truncate=1 \
@@ -57,7 +58,7 @@ $FSSTRESS_PROG -z -n 5000 -p 10 \
-f unlink=1 \
-f symlink=1 \
-f rename=1 \
- -d $SCRATCH_MNT/fsstress >> $seqres.full 2>&1
+ -d $SCRATCH_MNT/fsstress
# Loading error table without "--nolockfs" option. Because "--nolockfs"
# won't freeze fs, then some running I/Os may cause XFS to shutdown
@@ -26,8 +26,7 @@ _cleanup()
{
# Make sure $SCRATCH_MNT is unfreezed
xfs_freeze -u $SCRATCH_MNT 2>/dev/null
- $KILLALL_PROG -9 fsstress 2>/dev/null
- wait
+ _kill_fsstress
cd /
rm -f $tmp.*
}
@@ -102,8 +101,7 @@ _scratch_mount
_check_scratch_log_state
-$FSSTRESS_PROG -d $SCRATCH_MNT/fsstress -n 9999999 -p 2 -S t \
- >> $seqres.full 2>&1 &
+_run_fsstress_bg -d $SCRATCH_MNT/fsstress -n 9999999 -p 2 -S t
iters=5
while [ $iters -gt 0 ]; do
@@ -112,9 +110,7 @@ while [ $iters -gt 0 ]; do
iters=$((iters - 1))
done
-$KILLALL_PROG $FSSTRESS_PROG
-wait
-
+_kill_fsstress
_scratch_unmount
status=0
@@ -16,16 +16,6 @@ _begin_fstest auto metadata stress
# Import common functions.
. ./common/filter
-# Override the default cleanup function.
-_cleanup()
-{
- $KILLALL_PROG -9 fsstress 2>/dev/null
- wait
- cd /
- _scratch_unmount 2>/dev/null
- rm -f $tmp.*
-}
-
filter_enospc() {
sed -e '/^.*No space left on device.*/d'
}
@@ -103,8 +93,7 @@ _create $SCRATCH_MNT/dir1 $COUNT
_cleaner $SCRATCH_MNT $LOOPS $MINDIRS &
# start a background stress workload on the fs
-$FSSTRESS_PROG -d $SCRATCH_MNT/fsstress -n 9999999 -p 2 -S t \
- >> $seqres.full 2>&1 &
+_run_fsstress_bg -d $SCRATCH_MNT/fsstress -n 9999999 -p 2 -S t
# Each cycle clones the current directory and makes a random file replacement
# pass on the new directory. The directory is copied to the next using hard
@@ -127,8 +116,7 @@ do
_rand_replace $SCRATCH_MNT/dir$((i+1)) $COUNT
done
-$KILLALL_PROG fsstress
-wait
+_kill_fsstress
# clean out the competing fsstress allocations, then everything else
rm -rf $SCRATCH_MNT/fsstress
@@ -9,15 +9,6 @@
. ./common/preamble
_begin_fstest mount auto quick stress
-_register_cleanup "_cleanup; rm -f $tmp.*"
-
-# Override the default cleanup function.
-_cleanup()
-{
- echo "*** unmount"
- _scratch_unmount 2>/dev/null
-}
-
# Import common functions.
. ./common/filter
@@ -41,8 +32,8 @@ echo "*** test"
for l in 0 1 2 3 4
do
echo " *** test $l"
- FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -n 1000 $FSSTRESS_AVOID`
- $FSSTRESS_PROG $FSSTRESS_ARGS >>$seqres.full
+ FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -n 1000`
+ _run_fsstress $FSSTRESS_ARGS
_try_scratch_mount -o remount,ro \
|| _fail "remount ro failed"
@@ -7,4 +7,3 @@ QA output created by 017
*** test 3
*** test 4
*** done
-*** unmount
@@ -50,7 +50,7 @@ while [ $SECTORSIZE -le $PAGESIZE ]; do
fi
_scratch_mount
# light population of the fs
- $FSSTRESS_PROG -n 100 -d $SCRATCH_MNT >> $seqres.full 2>&1
+ _run_fsstress -n 100 -d $SCRATCH_MNT
_scratch_unmount
# Test "duplicate" copy at first, if $XFS_COPY_PROG won't do it.
@@ -68,7 +68,7 @@ mount -t xfs -o loop $SCRATCH_MNT/test.xfs $SCRATCH_MNT/test >> $seqres.full 2>&
|| _fail "!!! failed to loop mount xfs"
_log "stress"
-$FSSTRESS_PROG -d $SCRATCH_MNT/test -n 1000 $FSSTRESS_AVOID >> $seqres.full 2>&1 \
+_run_fsstress -d $SCRATCH_MNT/test -n 1000 \
|| _fail "!!! stress failed"
_log "clean"
@@ -88,7 +88,7 @@ mount -t ext2 -o loop $SCRATCH_MNT/test/test.ext2 $SCRATCH_MNT/test2 >> $seqres.
|| _fail "!!! failed to loop mount xfs"
_log "stress ext2 on xfs via loop"
-$FSSTRESS_PROG -d $SCRATCH_MNT/test2 -n 1000 $FSSTRESS_AVOID >> $seqres.full 2>&1 \
+_run_fsstress -d $SCRATCH_MNT/test2 -n 1000 \
|| _fail "!!! stress ext2 failed"
_log "clean"
@@ -11,15 +11,6 @@
. ./common/preamble
_begin_fstest shutdown auto log metadata
-# Override the default cleanup function.
-_cleanup()
-{
- cd /
- rm -f $tmp.*
- $KILLALL_PROG -9 $FSSTRESS_PROG > /dev/null 2>&1
- _scratch_unmount > /dev/null 2>&1
-}
-
# Import common functions.
. ./common/dmflakey
@@ -37,11 +28,10 @@ _scratch_mount
# Start a workload and shutdown the fs. The subsequent mount will require log
# recovery.
-$FSSTRESS_PROG -n 9999 -p 2 -w -d $SCRATCH_MNT &>> $seqres.full &
+_run_fsstress_bg -n 9999 -p 2 -w -d $SCRATCH_MNT
sleep 5
_scratch_shutdown -f
-$KILLALL_PROG -q $FSSTRESS_PROG
-wait
+_kill_fsstress
_scratch_unmount
# Initialize a dm-flakey device that will pass I/Os for 5s and fail thereafter.
@@ -26,12 +26,12 @@ _begin_fstest auto log recoveryloop
# Override the default cleanup function.
_cleanup()
{
- cd /
- rm -f $tmp.*
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
[ -e /sys/fs/xfs/$sdev/errortag/log_item_pin ] &&
echo 0 > /sys/fs/xfs/$sdev/errortag/log_item_pin
+ _kill_fsstress
wait > /dev/null 2>&1
+ cd /
+ rm -f $tmp.*
}
# Import common functions.
@@ -53,7 +53,7 @@ _scratch_mkfs_sized $((1024 * 1024 * 500)) >> $seqres.full 2>&1
_scratch_mount
# populate the fs with some data and cycle the mount to reset the log head/tail
-$FSSTRESS_PROG -d $SCRATCH_MNT -z -fcreat=1 -p 4 -n 100000 >> $seqres.full
+_run_fsstress -d $SCRATCH_MNT -z -fcreat=1 -p 4 -n 100000
_scratch_cycle_mount || _fail "cycle mount failed"
# Pin the tail and start a file removal workload. File removal tends to
@@ -54,7 +54,7 @@ ORIG_UUID=`_scratch_xfs_db -c "uuid" | awk '{print $NF}'`
_scratch_mount
# Put some stuff on the fs
-$FSSTRESS_PROG -d $SCRATCH_MNT -n 100 -p 4 >> $seqres.full 2>&1
+_run_fsstress -d $SCRATCH_MNT -n 100 -p 4
_scratch_unmount
# Can xfs_db change it?
@@ -17,19 +17,9 @@
. ./common/preamble
_begin_fstest shutdown auto log quick
-# Override the default cleanup function.
-_cleanup()
-{
- cd /
- rm -f $tmp.*
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
- wait > /dev/null 2>&1
-}
-
# Import common functions.
. ./common/log
-
# Modify as appropriate.
_require_scratch
_require_v2log
@@ -43,10 +33,10 @@ _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
_scratch_mount "-o logbsize=32k"
# Run a workload to dirty the log, wait a bit and shutdown the fs.
-$FSSTRESS_PROG -d $SCRATCH_MNT -p 4 -n 99999999 >> $seqres.full 2>&1 &
+_run_fsstress_bg -d $SCRATCH_MNT -p 4 -n 99999999
sleep 10
_scratch_shutdown -f
-wait
+_wait_for_fsstress
# Remount with a different log buffer size. Going from 32k to 64k increases the
# log record extended header count, as the log record header can only handle 32k
@@ -40,9 +40,8 @@ _stress_scratch()
procs=3
nops=1000
# -w ensures that the only ops are ones which cause write I/O
- FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs \
- -n $nops $FSSTRESS_AVOID`
- $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full 2>&1 &
+ args=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs -n $nops`
+ _run_fsstress_bg $args
}
_require_scratch
@@ -73,14 +72,11 @@ for i in `seq 125 -1 90`; do
break
done
-#
# Grow the filesystem while actively stressing it...
-# Kick off more stress threads on each iteration, grow; repeat.
-#
while [ $size -le $endsize ]; do
echo "*** stressing filesystem"
echo "*** stressing a ${sizeb} block filesystem" >> $seqres.full
- _stress_scratch
+ _stress_scratch
sleep 1
size=`expr $size + $incsize`
sizeb=`expr $size / $dbsize` # in data blocks
@@ -92,10 +88,8 @@ while [ $size -le $endsize ]; do
[ `expr $size % $modsize` -eq 0 ] && wait # every 4th iteration
echo AGCOUNT=$agcount | tee -a $seqres.full
echo && echo >> $seqres.full
+ _wait_for_fsstress
done
-wait # stop for any remaining stress processes
-
-_scratch_unmount
status=0
exit
@@ -29,7 +29,7 @@ _scratch_xfs_db -x -c "logformat -c 3" >> $seqres.full 2>&1
# do some work on the fs to update metadata LSNs
_scratch_mount
-$FSSTRESS_PROG -d $SCRATCH_MNT -n 999 -p 4 -w >> $seqres.full 2>&1
+_run_fsstress -d $SCRATCH_MNT -n 999 -p 4 -w
_scratch_unmount
# Reformat to the current cycle and try to mount. This fails in most cases
@@ -14,19 +14,9 @@
. ./common/preamble
_begin_fstest auto log metadata
-# Override the default cleanup function.
-_cleanup()
-{
- cd /
- rm -f $tmp.*
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
- wait > /dev/null 2>&1
-}
-
# Import common functions.
. ./common/inject
-
# Modify as appropriate.
_require_xfs_io_error_injection "log_bad_crc"
_require_scratch
@@ -49,7 +39,7 @@ while [ $nr_times -gt 0 ]; do
# Run fsstress until the filesystem shuts down. It will shut down
# automatically when error injection triggers.
- $FSSTRESS_PROG -d $SCRATCH_MNT -p 4 -n 999999 >> $seqres.full 2>&1
+ _run_fsstress -d $SCRATCH_MNT -p 4 -n 999999
# Verify that we can remount the fs. Log recovery should handle the torn
# write.
@@ -31,7 +31,7 @@ _scratch_mkfs -m crc=1,inobtcount=0 >> $seqres.full
_scratch_mount
mkdir $SCRATCH_MNT/stress
-$FSSTRESS_PROG -d $SCRATCH_MNT/stress -n 1000 >> $seqres.full
+_run_fsstress -d $SCRATCH_MNT/stress -n 1000
echo moo > $SCRATCH_MNT/urk
_scratch_unmount
@@ -56,7 +56,7 @@ _check_scratch_xfs_features NEEDSREPAIR INOBTCNT
echo "Filesystem should be usable again"
_scratch_mount
-$FSSTRESS_PROG -d $SCRATCH_MNT/stress -n 1000 >> $seqres.full
+_run_fsstress -d $SCRATCH_MNT/stress -n 1000
_scratch_unmount
_check_scratch_fs
_check_scratch_xfs_features INOBTCNT
@@ -9,20 +9,12 @@
. ./common/preamble
_begin_fstest rw metadata auto stress prealloc
-# Override the default cleanup function.
-_cleanup()
-{
- $KILLALL_PROG -r -q -TERM fsstress 2> /dev/null
- wait # ensures all fsstress processes died
-}
-
workout()
{
procs=100
nops=15000
- FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -p $procs -n $nops \
- $FSSTRESS_AVOID`
- $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full &
+ FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -p $procs -n $nops`
+ _run_fsstress_bg $FSSTRESS_ARGS
sleep 2
}
@@ -52,6 +44,8 @@ rm -f $TEST_FILE
workout
$TEST_PROG $LOOPS $TEST_FILE
+_kill_fsstress
+
echo " *** test done"
status=0
@@ -38,9 +38,8 @@ stress_scratch()
local procs=3
local nops=1000
# -w ensures that the only ops are ones which cause write I/O
- local FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w \
- -p $procs -n $nops $FSSTRESS_AVOID`
- $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full 2>&1
+ local args=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs -n $nops`
+ _run_fsstress_bg $args
}
_require_scratch_xfs_shrink
@@ -73,7 +72,7 @@ while [ $totalcount -gt 0 ]; do
decsize=`expr 41 \* 1048576 + 1 + $RANDOM \* $RANDOM % 1048576`
while [ $size -gt $endsize ]; do
- stress_scratch &
+ stress_scratch
sleep 1
decb=`expr $decsize / $dbsize` # in data blocks
@@ -95,6 +94,7 @@ while [ $totalcount -gt 0 ]; do
. $tmp.growfs
size=`expr $dblocks \* $dbsize`
+ _kill_fsstress
_scratch_unmount
_scratch_xfs_repair -n >> $seqres.full 2>&1 || \
_fail "xfs_repair failed with shrinking $sizeb"
@@ -55,7 +55,7 @@ do_test()
# start a metadata-intensive workload, but no data allocation operation.
# Because uncompleted new space allocation I/Os may cause XFS to shutdown
# after loading error table.
- $FSSTRESS_PROG -z -n 5000 -p 10 \
+ _run_fsstress -z -n 5000 -p 10 \
-f creat=10 \
-f resvsp=1 \
-f truncate=1 \
@@ -67,7 +67,7 @@ do_test()
-f unlink=1 \
-f symlink=1 \
-f rename=1 \
- -d $SCRATCH_MNT/fsstress >> $seqres.full 2>&1
+ -d $SCRATCH_MNT/fsstress
# Loading error table without "--nolockfs" option. Because "--nolockfs"
# won't freeze fs, then some running I/Os may cause XFS to shutdown
@@ -80,7 +80,7 @@ if [ $? -ne 0 ]; then
else
# no hang/panic is fine
cat $SCRATCH_MNT/testfile > /dev/null
- $FSSTRESS_PROG -d $SCRATCH_MNT -p 4 -n 400 >>$seqres.full 2>&1
+ _run_fsstress -d $SCRATCH_MNT -p 4 -n 400
fi
# remount as rw, kernel should reject it
@@ -16,8 +16,7 @@ _cleanup()
{
# Make sure $SCRATCH_MNT is unfreezed
xfs_freeze -u $SCRATCH_MNT 2>/dev/null
- $KILLALL_PROG -q -9 $FSSTRESS_PROG
- wait
+ _kill_fsstress
cd /
rm -f $tmp.*
}
@@ -37,7 +36,7 @@ _scratch_mount
STRESS_DIR="$SCRATCH_MNT/testdir"
mkdir -p $STRESS_DIR
-$FSSTRESS_PROG -d $STRESS_DIR -n 100 -p 1000 $FSSTRESS_AVOID >>$seqres.full &
+_run_fsstress_bg -d $STRESS_DIR -n 1000 -p 1000 $FSSTRESS_AVOID
# Freeze/unfreeze file system randomly
echo "Start freeze/unfreeze randomly" | tee -a $seqres.full
@@ -60,8 +59,7 @@ while [ $LOOP -gt 0 ];do
let LOOP=$LOOP-1
done
echo "Test done" | tee -a $seqres.full
-$KILLALL_PROG -q $FSSTRESS_PROG
-wait
+_kill_fsstress
status=0
exit
@@ -4,7 +4,7 @@
#
# FS QA Test No. 305
#
-# Test to verify that turn group/project quotas off while fstress and
+# Test to verify that turn group/project quotas off while fsstress and
# user quotas are left on.
#
. ./common/preamble
@@ -18,7 +18,6 @@ _begin_fstest auto quota
_require_scratch
_require_xfs_quota
-_require_command "$KILLALL_PROG" killall
_scratch_mkfs_xfs -m crc=1 >/dev/null 2>&1
@@ -33,12 +32,11 @@ _exercise()
_qmount
mkdir -p $QUOTA_DIR
- $FSSTRESS_PROG -d $QUOTA_DIR -n 1000000 -p 100 $FSSTRESS_AVOID >>$seqres.full &
+ _run_fsstress_bg -d $QUOTA_DIR -n 1000000 -p 100
sleep 10
$XFS_QUOTA_PROG -x -c "disable -$type" $SCRATCH_DEV
sleep 5
- $KILLALL_PROG -q $FSSTRESS_PROG
- wait
+ _kill_fsstress
}
echo "*** turn off group quotas"
@@ -12,14 +12,6 @@
. ./common/preamble
_begin_fstest auto stress clone quota
-# Override the default cleanup function.
-_cleanup()
-{
- cd /
- rm -f $tmp.*
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
-}
-
# Import common functions.
. ./common/quota
. ./common/filter
@@ -72,7 +64,7 @@ _scratch_mount >> $seqres.full 2>&1
nr_cpus=$((LOAD_FACTOR * 4))
nr_ops=$((25000 * nr_cpus * TIME_FACTOR))
-$FSSTRESS_PROG $FSSTRESS_AVOID -w -d $SCRATCH_MNT -n $nr_ops -p $nr_cpus >> $seqres.full
+_run_fsstress -w -d $SCRATCH_MNT -n $nr_ops -p $nr_cpus
echo "Check quota before remount"
check_quota_du_blocks
@@ -46,7 +46,7 @@ echo "Inject bmap_alloc_minlen_extent error tag"
_scratch_inject_error bmap_alloc_minlen_extent 1
echo "Execute fsstress"
-$FSSTRESS_PROG -d $SCRATCH_MNT \
+_run_fsstress -d $SCRATCH_MNT \
$(_scale_fsstress_args -p 75 -n 1000) \
-f bulkstat=0 \
-f bulkstat1=0 \
@@ -61,7 +61,7 @@ $FSSTRESS_PROG -d $SCRATCH_MNT \
-f readv=0 \
-f stat=0 \
-f aread=0 \
- -f dread=0 >> $seqres.full
+ -f dread=0
# success, all done
status=0
@@ -18,21 +18,12 @@ _stress_scratch()
nops=999999
# -w ensures that the only ops are ones which cause write I/O
FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs \
- -n $nops $FSSTRESS_AVOID`
- $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full 2>&1 &
+ -n $nops`
+ _run_fsstress_bg $FSSTRESS_ARGS >> $seqres.full 2>&1
}
_require_scratch
_require_command "$XFS_GROWFS_PROG" xfs_growfs
-_require_command "$KILLALL_PROG" killall
-
-_cleanup()
-{
- $KILLALL_ALL fsstress > /dev/null 2>&1
- wait
- cd /
- rm -f $tmp.*
-}
_scratch_mkfs_xfs | _filter_mkfs >$seqres.full 2>$tmp.mkfs
. $tmp.mkfs # extract blocksize and data size for scratch device
@@ -63,12 +54,7 @@ while [ $size -le $endsize ]; do
sleep $((RANDOM % 3))
_scratch_shutdown
- ps -e | grep fsstress > /dev/null 2>&1
- while [ $? -eq 0 ]; do
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
- wait > /dev/null 2>&1
- ps -e | grep fsstress > /dev/null 2>&1
- done
+ _kill_fsstress
_scratch_cycle_mount
done > /dev/null 2>&1
wait # stop for any remaining stress processes
@@ -18,22 +18,13 @@ _stress_scratch()
nops=999999
# -w ensures that the only ops are ones which cause write I/O
FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs \
- -n $nops $FSSTRESS_AVOID`
- $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full 2>&1 &
+ -n $nops`
+ _run_fsstress_bg $FSSTRESS_ARGS >> $seqres.full 2>&1
}
_require_scratch
_require_realtime
_require_command "$XFS_GROWFS_PROG" xfs_growfs
-_require_command "$KILLALL_PROG" killall
-
-_cleanup()
-{
- $KILLALL_ALL fsstress > /dev/null 2>&1
- wait
- cd /
- rm -f $tmp.*
-}
_scratch_mkfs_xfs | _filter_mkfs >$seqres.full 2>$tmp.mkfs
. $tmp.mkfs # extract blocksize and data size for scratch device
@@ -65,12 +56,7 @@ while [ $size -le $endsize ]; do
sleep $((RANDOM % 3))
_scratch_shutdown
- ps -e | grep fsstress > /dev/null 2>&1
- while [ $? -eq 0 ]; do
- $KILLALL_PROG -9 fsstress > /dev/null 2>&1
- wait > /dev/null 2>&1
- ps -e | grep fsstress > /dev/null 2>&1
- done
+ _kill_fsstress
_scratch_cycle_mount
done > /dev/null 2>&1
wait # stop for any remaining stress processes