]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
fstests: cleanup fsstress process management
authorDave Chinner <dchinner@redhat.com>
Tue, 26 Nov 2024 20:41:25 +0000 (07:41 +1100)
committerZorro Lang <zlang@kernel.org>
Sun, 8 Dec 2024 13:59:15 +0000 (21:59 +0800)
Lots of tests run fsstress in the background and then have to kill
it and/or provide special cleanup functions to kill the background
fsstress processes. They typically use $KILLALL_PROG for this.

Use of killall is problematic for running multiple tests in parallel
in that one test can kill other tests' processes.  However, because
fsstress itself forks and runs children, there are very few avenues
for shell scripts to ensure all the fsstress processes actually die.

With bash, it is especially nasty, because sending SIGTERM will
result in bash outputting error messages ("Killed: ..." that will
cause golden output mismatches and hence test failures. Hence we
also need to be able to tell the main fstress process to die without
triggering these messages.

To avoid the process tracking problems, we change to use pkill
rather than killall (more options for process selection) and we
stop using the $here/ltp/fsstress binary. Instead, we copy the
$here/ltp/fsstress to $TEST_DIR/$seq.fsstress so that the test has
a unique fsstress binary name. This allows the pkill filter to
select just the fsstress processes the test has run. The fsstress
binary name is held in _FSSTRESS_NAME, and the program to run is
_FSSTRESS_PROG.

We also track the primary fsstress process ID, and store that in
_FSSTRESS_PID. We do this so that we have a PID to wait against so
that we don't return before the fsstress processes are dead. To this
end, we add a SIGPIPE handler to the primary process so that it
dying doesn't trigger bash 'killed' message output. We can
send 'pkill -PIPE $_FSSTRESS_NAME' to all the fsstress processes and
the primary process will then enter the "wait for children to die"
processing loop before it exits. In this way, we can wait for the
primary fsstress process and when it exits we know that all it's
children have also finished and gone away. This makes killing
fsstress invocations reliable and noise free.

This is accomplished by the helpers added to common/rc:

_run_fsstress
_run_fsstress_bg
_wait_for_fsstress
_kill_fstress

This also means that all fsstress invocations now obey
FSSTRESS_AVOID environment restrictions, many of which didn't.

We add a call to _kill_fstress into the generic _cleanup() function.
This means that tests using fsstress don't need to add a special
local _cleanup function just to call _kill_fsstress() so that
background fsstress processes are killed when the user interrupts
the tests with ctrl-c.

Further, killall in the _cleanup() function is often used to attempt
to expedite killing of foreground execution fsstress processes. This
doesn't actually work because of the way bash processes interupt
signals. That is, it waits for the currently executing process to
finish execution, then runs the trap function. Hence a foreground
fsstress won't ever be interrupted by ctrl-c. By implementing
_run_fsstress() as a background process and a wait call, the wait()
call is interrupted by the signal and the cleanup trap is run
immediately. Hence the fsstress processes are killed immediately and
the test exits cleanly almost immediately.

The result of all this is common, clean handling of fsstress
execution and termination. There are a few exceptions for special
cases, but the vast majority of tests that run fsstress use the
above four wrapper functions exclusively.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Zorro lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
105 files changed:
common/fuzzy
common/preamble
common/rc
ltp/fsstress.c
tests/btrfs/004
tests/btrfs/007
tests/btrfs/012
tests/btrfs/028
tests/btrfs/049
tests/btrfs/057
tests/btrfs/060
tests/btrfs/061
tests/btrfs/062
tests/btrfs/063
tests/btrfs/064
tests/btrfs/065
tests/btrfs/066
tests/btrfs/067
tests/btrfs/068
tests/btrfs/069
tests/btrfs/070
tests/btrfs/071
tests/btrfs/072
tests/btrfs/073
tests/btrfs/074
tests/btrfs/078
tests/btrfs/100
tests/btrfs/101
tests/btrfs/136
tests/btrfs/192
tests/btrfs/195
tests/btrfs/212
tests/btrfs/232
tests/btrfs/252
tests/btrfs/261
tests/btrfs/284
tests/btrfs/286
tests/btrfs/320
tests/btrfs/332
tests/ext4/004
tests/ext4/057
tests/ext4/058
tests/ext4/307
tests/generic/013
tests/generic/019
tests/generic/051
tests/generic/055
tests/generic/068
tests/generic/070
tests/generic/076
tests/generic/076.out
tests/generic/083
tests/generic/083.out
tests/generic/117
tests/generic/232
tests/generic/232.out
tests/generic/269
tests/generic/270
tests/generic/388
tests/generic/390
tests/generic/409
tests/generic/410
tests/generic/411
tests/generic/461
tests/generic/475
tests/generic/476
tests/generic/482
tests/generic/547
tests/generic/560
tests/generic/561
tests/generic/579
tests/generic/585
tests/generic/589
tests/generic/642
tests/generic/648
tests/generic/650
tests/generic/750
tests/generic/753
tests/overlay/019
tests/overlay/021
tests/xfs/006
tests/xfs/011
tests/xfs/013
tests/xfs/017
tests/xfs/017.out
tests/xfs/032
tests/xfs/049
tests/xfs/051
tests/xfs/057
tests/xfs/077
tests/xfs/079
tests/xfs/104
tests/xfs/137
tests/xfs/141
tests/xfs/158
tests/xfs/167
tests/xfs/168
tests/xfs/264
tests/xfs/270
tests/xfs/297
tests/xfs/305
tests/xfs/442
tests/xfs/538
tests/xfs/609
tests/xfs/610

index 14d6cb104aaf5796c4b211927980dbc34fbfbd25..9181520a3054fe4bcb431f1bfeeedc95d926d73c 100644 (file)
@@ -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" &
index e60cd949ac4135b124b0195ccb310e835d7eeaa0..78e45d522f482ce1e51fe40d9b401df70b0eda3d 100644 (file)
@@ -7,6 +7,7 @@
 # Standard cleanup function.  Individual tests can override this.
 _cleanup()
 {
+       _kill_fsstress
        cd /
        rm -r -f $tmp.*
 }
index 6592c8350afc1cf3268a9129bfd3f84c37e81cb3..14a9526dac3250d23f0956c3601da692cb5c57dd 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -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"
index 3d248ee257915335051ea15012c99de135c99f29..a6840f28c90d82eade51bbf4ba516e808a423157 100644 (file)
@@ -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;
+                       action.sa_handler = sg_handler;
                        if (sigaction(SIGTERM, &action, 0))
                                return 1;
-                       action.sa_handler = sg_handler;
                        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;
 
index 5a2ce99312db6c7f94439d4bafbf62a0a23dee28..06eedde22e0b563ba90c29ea58b4ae98298b530b 100755 (executable)
@@ -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 &
index a7eb6216286c1f6ef6d899214c0571edc3c9f2b6..d9cc327503931a00c73bbdcd2746b227c4fb73a5 100755 (executable)
@@ -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
index 5811b3b339cb3eba63c8994f4d8eab1b83bbfede..f41d7e4eb864a7e9545a90e9e7f924e645878eb7 100755 (executable)
@@ -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
 
index 05366e5a18af64a2f09c6ddd3aee3a450178c13a..b41e1077afc2744937297fbf982c7bd8f76c1089 100755 (executable)
@@ -20,10 +20,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
@@ -45,8 +42,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 &
@@ -54,10 +50,9 @@ 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
-unset fsstress_pid balance_pid
+unset balance_pid
 
 # The qgroups accounting will be checked by 'btrfs check' (fsck) after the
 # fstests framework unmounts the filesystem.
index 19eec785167f3a3b58ec0077d867c5d3ac0a374f..5c09942eed9356543ea18a5ef2e512b77a97555f 100755 (executable)
@@ -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.
index 6c399946322462f1cd5408e05d102728878b7dff..1e871dd1be5001867be7868608f1e2ec4cc36141 100755 (executable)
@@ -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
index 75c10bd23c36f59fd86cc46d32932d05b4fff8c1..21f15ec8973baf3af83f39af57f0ecc8ed1bf3a8 100755 (executable)
@@ -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
index 2b3b76a7fcc1d4f0ffd000ff4adc8f7241f6429a..5a2bd709061f09e2f562b519a945ea6480fe3b22 100755 (executable)
@@ -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
index 4ab7ca53416a5bf4ac7fc8a18935eda1b4f3bb41..a25d6d117dcf86d7c10f799efd47f41cabacaf58 100755 (executable)
@@ -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
index ea4275d29ff89ae3f4a15d9c2391e7e15a846452..7d51ff554bfe1bc9523094aa5175d844c5318b85 100755 (executable)
@@ -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
index a8aa625131b5d905acb6491af5361450cd0049a7..3b98f327e5b1b3fd4c7427ff46a7faf7f0cb3e8f 100755 (executable)
@@ -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
index b87c66d6e3d45e86fa63f34eb19f5b7a78ec5c56..f0c9ffb043a0a502d2de9d5f028fede1bd83dfdf 100755 (executable)
@@ -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
index cc7cd9b7273d1ca93ffafe1157e8782f1a03ee02..e3a083b94ad23f89cb141b6e734353413f6214cb 100755 (executable)
@@ -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
index 0b473050027a0a7f33ded550f7a99b64c18ba504..768993116bd6de0363f439327b0fe775ce02fc93 100755 (executable)
@@ -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
index 83e932e8417c0d2e0e4a1b69970d828febdf1b5b..3d221259fa8cc45ea63065e364f6281eadfcd5b8 100755 (executable)
@@ -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
index 5105517603bd4c69e4f39ab7d24f80a1ef05c847..7954e80a8c3ab3841a28f83ad2add25e4a21b4af 100755 (executable)
@@ -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
index f2e9dfcb19f46a2d9be1b47462314c5be69e5b8e..c183800349a71b84e9b15f4c0a3d658422771879 100755 (executable)
@@ -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
index 5c65bcfe0b07cd8abb364f72a563a32aafb467dc..5c2b725b01161951d3329b574e2d258134bbc8f4 100755 (executable)
@@ -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
index 0a3da5ffd35513fe075990161c3a1a41146ba2c2..3275088743823475b72b02cbe653309c846ae56a 100755 (executable)
@@ -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
index bf7e9ca7aac228ef7c06ffddd9971155eb7577e7..b77e14c914b16786492958374e88ad1368229fd8 100755 (executable)
@@ -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
index f782671594fd85d11c59deebd545a04c5d863d02..a752707db54b5ac319ca2d53b54508a637c38bd4 100755 (executable)
@@ -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
index bbebeff3937c6d997369c490420832422aea3318..b802f9d862c381973774b3818b80d6e1bbd812c8 100755 (executable)
 . ./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
index 46bfc4f74b25fd760dbce360ee1aba9006b56fc9..a319c7bbb091459240bc2e342a1d7d951983e0a5 100755 (executable)
@@ -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
index c65e14ea01eaf64d52d9089a2358d1b0e04b81c7..cb14d6a0783e0e866a8fe1164c9cc5e5576a8e19 100755 (executable)
@@ -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
index 2a5280fb9bd132a674aefb04038f4ad70ce8fd74..65bbcf516f9c86ad98134c91e23083e20e6ac066 100755 (executable)
@@ -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
index f7fb65b8dc57bff64aba3c28306a521e6227609b..cc8e1e003dadbb9e95f0f84d9cd85186153aff73 100755 (executable)
@@ -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
index 72fc3a77551ed29eb1e0f0163fc8eae5201076ee..4dffddc1ac57c098544d3313cf9be8325008f693 100755 (executable)
@@ -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"
index f356d7d0f22960421be1afc0c8bf88621aca6b6c..745b9598aa6b614e6d924e408e2b41f4d60cd60a 100755 (executable)
@@ -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
index 4dcc39cc4975dcd1f4b83be760871b49a02390f7..f843edbf7c84a5a5b7cc28c4d8c81f82cfa583a9 100755 (executable)
@@ -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
 }
 
index 2da02ffa194584bfd23d6cb638c68aaf15e13a43..bb111b909f3b5852fe250d3fcb8b5937be8e6625 100755 (executable)
@@ -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"`)
 
index 4052baaec335ae9d2d736d8cf14e926c1e9ba5da..7a08b56675efdf8a52bfaeb4ffb33090a2b04f35 100755 (executable)
@@ -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
index 6c554f32540cdfb0299c59a591efe0a724a0d604..ec3bc2720935e4ab53ef71a2daf87bd6ad8fa4e1 100755 (executable)
@@ -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
index b8fa276735da5660baf2303b29ef5925f3357b36..7909fa5075f5cf8079af6ff70a4a0f91fbbf6aed 100755 (executable)
@@ -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
index 15549165e3c2ac0042e8ab3fe3a815872a4027fa..bcfb96d1a42a1acf9f4ac38a80a9485e64372ff2 100755 (executable)
@@ -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
index ab9860668031bd28fd3b2ec4f0785708e0104639..4fcdad4cdfd4ef7b0d95f94e7ec58b025129274b 100755 (executable)
@@ -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
index 20cfdb444251c72688c45dd82a409055af830fce..ab2f838e9facc65885d4a7fc1ce2164c5297df5c 100755 (executable)
@@ -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
index 529f0c2985aac6400fa7432fa1f0e7976adccc65..73cdf941a181d7e32bea8ff110af72592f6587b4 100755 (executable)
@@ -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
index a7fc5e6c6d7a53fde0f8b110cf8b4a4a7cee6cc3..f853649644dbc5500e56de2dbc12c779ffd54a8d 100755 (executable)
@@ -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"
 
index f7c95c51b0cc7c1475606198f59493ebc6c58fcd..8361f04312b256dc758b18e967d939c32dc3933a 100755 (executable)
@@ -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 }'`
index 3a000b97f8df82fdd7217d069f6b5f9554a68c32..0b86d8b334a630f77aa9d6972808adbf482d26a5 100755 (executable)
@@ -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
 
index fe117ac8a1f892c5a9f5d17beedde5697c845b01..bed916b53f98e50eaf4813d78a693e6a8fe12ae5 100755 (executable)
@@ -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
index 65571fdd00ea5e34f5e2abfd092a4041a9dfa044..69250cde6b38d89ac9e543a38f3197b3728f6bfa 100755 (executable)
@@ -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
index b1126c901fe10db9283b01ccabe465622e3571f9..e57f95faf8977745d775986dc06b96b334d3d955 100755 (executable)
@@ -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
 }
index 1e8248b9d034519bab3634c6756e242fa2f98e50..26c5ceea6e56c39b772d9a1b2b7b6c2bba54911b 100755 (executable)
@@ -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/*
index a8e84effd6b1f40dce2d4be89a166bf14baeeaa0..000fc0482272a4d0d902503620e03a33c000f8d6 100755 (executable)
@@ -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
index b50c2df5ee9cc22a6ff3753e4dc1ff0748df9de5..100f197159163d1fe7ef30ae0b394fd64fb1f1fd 100755 (executable)
@@ -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"
index 54a8f70968eefacc8c77522a44be737ddd0fba85..74a65bdec6975c8dd49643a1c593548f0f8ebff0 100644 (file)
@@ -2,4 +2,3 @@ QA output created by 076
 *** init fs
 *** test concurrent block/fs access
 *** done
-*** unmount
index ff4785eee8afec9fec9b9ae6090e52ed13583d61..6aa0ea06df25a2b90be6c57c89c4a4e83bb861e7 100755 (executable)
 . ./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"
index 025afe30e8841a47c0a727e2b4f1f2161310e398..b853eadb4ddcb882b16665af669dedbc1f745b20 100644 (file)
@@ -1,4 +1,3 @@
 QA output created by 083
 *** test out-of-space handling for random write operations
 *** done
-*** unmount
index f9769be9480e56286c60ac857e71ab47cb50e715..a34f861653a337409531b455b86b8392e912f1c5 100755 (executable)
@@ -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
index 35934cc1867014680f61d94e6025307600729d0c..c903a56190453bde9f7643b9d9de7f1f549d0f49 100755 (executable)
@@ -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
 }
index 5da53d4bf958232e89bf8eb5fa885aa633d408ae..9214607f0e210afa16c2f73f3c167fc774e8e841 100644 (file)
@@ -2,6 +2,5 @@ QA output created by 232
 
 Testing fsstress
 
-seed = S
 Comparing user usage
 Comparing group usage
index 341fcd22f321796ec51b7d297d186c80d825ceb9..979cc15cb08bafb32248a83bf45a7254f075cbc5 100755 (executable)
@@ -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
index cf523f4eacb7ff79bc596c74f5b14d8073eb4eaf..aff379ac5e4cd7677b76e6f32016d294db186f77 100755 (executable)
@@ -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
index 89ddda31df4f6036af1d18081906199e41be2007..34609a0d30ecb18417b4dfbcfa657e48fe8fdd23 100755 (executable)
 . ./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.
index 02f6c5eef4e0b8bbda3ddfff9017bab7809f4f3a..52270782e488314ef6662686ae6885f4b70ad51c 100755 (executable)
@@ -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
 
index b7edc2ac664461fd376317e97577b704eb0b930e..ab7e7eb55973f584d78bfda650ce27820ed56a5d 100755 (executable)
@@ -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
 }
 
index 902f27144285e4979a9eaedd860e60f3760cfb6f..f0f0921be264b0f443861c1209ae3465a4d3e6a6 100755 (executable)
@@ -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
 }
 
index c35436c82e988e4834b782fb56dfcea59da07be6..3b55b4f9160952589a3cfc3397a49cfc53f629d4 100755 (executable)
@@ -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
 }
 
index 468ce46f0052f5c8d9b56fff0f34c8ef347f80e6..95dd6a34dd37a710133433304cb6822ed6dd7c11 100755 (executable)
@@ -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
index 4b854f9ab556366e5f3761dcfe416cedeccb9190..9df2051fb09aab9bd3598ae35f4930cc9e0be7cf 100755 (executable)
@@ -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.
index cf7402a12a485949cef46a7f51eda71c5362fb5d..769b3745f75689e1dfaa6efddd0a739dfe97adc6 100755 (executable)
 . ./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
index 54fee07d4cfba4f3c123b78220159c42f7a4dd25..8c114ee03058c627e897f800a4410071f536fcd9 100755 (executable)
@@ -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
index 1e3881db90615e5804593f3d191ec4b4a8af93e6..14d02b4fdc8e36fe4908e502842bde2202a18f8c 100755 (executable)
@@ -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 {} \;
index 62983d69b959b1e1fbe32d0e291a2ceb52e20b8c..067d3ec0049e9dcd3be1d3befb970145094bbcf8 100755 (executable)
@@ -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}'`
index 39e5977a3bfa1d857dc238e2ff7929501509a5a6..854aedab499fbd9acefd9c8d1febdf9bb4ce241c 100755 (executable)
@@ -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,21 @@ _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
+               pkill $dedup_bin >/dev/null 2>&1
                wait $dedup_pids
+               rm -f $dedup_prog
        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 +46,11 @@ 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_bin=${seq}.duperemove
+dedup_prog=$TEST_DIR/$dedup_bin
+cp -f $DUPEREMOVE_PROG $dedup_prog
 dedup_pids=""
 dupe_run=$TEST_DIR/${seq}-running
 # Start several dedupe processes on same directory
@@ -65,7 +62,7 @@ for ((i = 0; i < $((2 * LOAD_FACTOR)); i++)); do
                # dupremove processes in an arbitrary order, which leaves the
                # memory in an inconsistent state long enough for the assert
                # to trip.
-               cmd="$DUPEREMOVE_PROG -dr --dedupe-options=same $testdir"
+               cmd="$dedup_prog -dr --dedupe-options=same $testdir"
                bash -c "$cmd" >> $seqres.full 2>&1
        done 2>&1 | sed -e '/Terminated/d' &
        dedup_pids="$! $dedup_pids"
index 3191342b34711d019a6047c6e5b18d70ac613454..4187ab0f05433aa9992d4f43a940a33f505b118f 100755 (executable)
@@ -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
index fb675c8d5d05ea8d2b1a532b551b70205648e91f..b95cd9abf175a1f36c95eb1a28de17c035b72c08 100755 (executable)
@@ -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
 
index 0ce16556a05df9e5afac8728012f685c9523f651..969a8ac61a53063dcce2a32359d83c24b741d98b 100755 (executable)
@@ -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
 }
 
index a7112a08fd59c380b577f61287113368066cce7f..4b92a9c181d49c3a83bbd450f05375988281dff0 100755 (executable)
 . ./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
index 29d1b470bded4a59b269521fe38c9e94a566a4c3..e4c9990e1a9d861a4e287d2dc03a32e5963f9fe1 100755 (executable)
@@ -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
index 5d2cb897797a0b67930922d51da1c9afd7f3ebb6..36a23e48d82b3122031ab5ed168996752aa7a0fc 100755 (executable)
@@ -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
 
index dba8021d6a2815cbc72f1e1c29dbcab13c87fa48..5c54a5c7888f1d7e08af0cd987d7705bc54a2811 100755 (executable)
@@ -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
index e427d62d1d208e84a8c1eac08fb2c03acee14282..f5665320aa2557af7063d0d80edeb2ae0a70da80 100755 (executable)
@@ -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.
index ae026604dd6b8fcfb42e5e61c3d1175480abde0f..b20b7ae522df5376ea877bf90b4e06ff3d391c30 100755 (executable)
@@ -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
index 95a9ada5d3f47faf1a356930bd313edc33e07e34..ee5a51007b2c58577e69331b20ca0ccfe1fe712c 100755 (executable)
@@ -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
index 50b36947d8d506a8ef3cb19633cbc6fd5c3013c1..20fd104bc42b38b082c8ef9232594f295327b766 100755 (executable)
@@ -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
index df967f098e0f502156dbbc14d7e911abf6340b5b..ed69879c53ce3818b781a902ad3a39f10ad66ee2 100755 (executable)
@@ -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
index f4f406aa94f3a67525d7072d9598bafc5a1a84ee..c68c6ad852f0874d7e2eec1530d00ce210eae22c 100755 (executable)
@@ -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
index c40d9cf09a8185dd92c05506572167c10adbb987..263ecc7530ef7c72d2d858a45802d9a9f743c4c8 100755 (executable)
@@ -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"
index 2d11c949266d76340078069d4ff36d49a4b78729..e61793df1aeab487616a8c9bff34953e43740ecd 100644 (file)
@@ -7,4 +7,3 @@ QA output created by 017
     *** test 3
     *** test 4
 *** done
-*** unmount
index 75edf0e9c7268d1074fe77a265f43a85f7c66260..1ecc02fe05f965e3864e92438f825bd1144eed23 100755 (executable)
@@ -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.
index 668ac374576a6966de5822e63c9b9d0d63512f8a..4163a144f34a7c0fd1e8ff388b6144494bbd5013 100755 (executable)
@@ -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"
index 43fee4c4511b183ec05d966b4f6725f56bdb0b6a..bb9c36da8fc426c389dda30d92ff234fabf4b078 100755 (executable)
 . ./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.
index f1c947795ccc22caa5da40c622d6a05b4cb96056..62eb8b93c19f2b75d445729c504cd01cc44c9a6c 100755 (executable)
@@ -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
index 4a4ac4702e756a522ae79f774d21869c17f8ca83..3d8ecd9f6f6ae3af49f598704c2103ca26417d4f 100755 (executable)
@@ -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?
index 46a15ed78ce6150296e30a21eb6232348c0dbece..794d2db4967786907e24d53a7f8e0414ab593ad4 100755 (executable)
 . ./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
index 7f11f89a550aa89363f729d401073f62db4e89c9..cd625d6b74aaaf40180dfb6c835a83f1964c46dd 100755 (executable)
@@ -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
index dfc653573fe51a145586d0e5814c7fc991f27db3..d97942bf671afab839651a979cb22e0c9046299c 100755 (executable)
@@ -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
index 5e9067e2465aed3058cc344447e2dc4b26260c29..b630ba10db0e0fcc7f64a36facb7f33dc8548703 100755 (executable)
 . ./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.
index 3c4e60f0ec914301cc72a8a355da08e1263d4570..89bf8c85165929978736b4134192d4213a3c2491 100755 (executable)
@@ -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
index f9da261db65c5cc1e61a2af63130576139d1094e..5ef2aa2ea0839de8c7e44a3e3346f7da48cc9618 100755 (executable)
@@ -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
index f187a336f460cf5b5bad161b5767e11326a0725a..098e0c86afd64db9cedae31e473bd62db5875342 100755 (executable)
@@ -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"
index 109fecd1ce580fb38fa1fa637777890fdde2ac8a..a6e816d3c611a9c7e7d040bdc639b5678129be81 100755 (executable)
@@ -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
index 3744df5a938092f6c6f5ee0870d0ecad0d858bf5..d3bce386ad091e060d32dcd134819aea1f6ffce6 100755 (executable)
@@ -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
index 2c5b03c5c539e0f44c5bc86c4582c42db2f1106e..66c5d0cc710f65652825df29fc335ef99402b3f4 100755 (executable)
@@ -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
index 0ad3ef7fb160fc76c7fa9090cdca442d4b34337f..6371ed8a63f31110e3c577d0efd407a4368839e4 100755 (executable)
@@ -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"
index 77d08fda5958116612b19a90cc56ee6dd6206882..5cbd8dd1925158fc5976633ec9b446cfd8615917 100755 (executable)
 . ./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
index 57113d3415b8b5bcd62d68432beca3e7f3d052cb..f858cadc34a45f955e0696fcb3232c5512a7ae3d 100755 (executable)
@@ -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
index c23b6893d20e292706274e1b0566c5c2490ca136..88dc3c683172c46476f52a5a5b4a09dda8eab075 100755 (executable)
@@ -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
index 23fbd85857a397d3158545ff0fbcb56b7a5b20ee..8610b912c2a61e53b10602510796db7d6c47f7a3 100755 (executable)
@@ -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