]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common/rc: don't copy fsstress to $TEST_DIR
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Feb 2025 22:00:28 +0000 (14:00 -0800)
committerZorro Lang <zlang@kernel.org>
Tue, 18 Feb 2025 04:42:39 +0000 (12:42 +0800)
Now that we can pkill only processes that were started by this test, we
don't need to copy the fsstress binary to $TEST_DIR to avoid killing the
wrong program instances.  This avoids a whole slew of ETXTBSY problems
with scrub stress tests that run multiple copies of fsstress in the
background.

Revert most of the changes to generic/270, because it wants to do
something fancy with the fsstress binary, so it needs to control the
process directly.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/rc
tests/generic/270

index f327796974d1dfd3bf2942ec949655b8115b1b7d..a8838d29b23a20fc430472247a458779e9bab592 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -54,11 +54,9 @@ _pkill()
 # 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.
+# they can 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()
 {
@@ -69,7 +67,6 @@ _wait_for_fsstress()
                ret=$?
                unset _FSSTRESS_PID
        fi
-       rm -f $_FSSTRESS_PROG
        return $ret
 }
 
@@ -78,8 +75,7 @@ _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
+               _pkill --echo -PIPE fsstress >> $seqres.full 2>&1
                _wait_for_fsstress
                return $?
        fi
@@ -87,8 +83,7 @@ _kill_fsstress()
 
 _run_fsstress_bg()
 {
-       cp -f $FSSTRESS_PROG $_FSSTRESS_PROG
-       $_FSSTRESS_PROG $FSSTRESS_AVOID "$@" >> $seqres.full 2>&1 &
+       $FSSTRESS_PROG $FSSTRESS_AVOID "$@" >> $seqres.full 2>&1 &
        _FSSTRESS_PID=$!
 }
 
index d74971bb5352392eaf1c7d29db82ab3c0c3621e1..ce51592004fe7748a11c651924b94293924e777e 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 $_FSSTRESS_PROG
-       $SETCAP_PROG cap_chown=epi $_FSSTRESS_PROG
+       cp $FSSTRESS_PROG $tmp.fsstress.bin
+       $SETCAP_PROG cap_chown=epi $tmp.fsstress.bin
 
        # 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,7 @@ _workout()
        # io_uring_queue_init fail on ENOMEM, set max locked memory to unlimited
        # temporarily.
        ulimit -l unlimited
-       _su $qa_user -c "$_FSSTRESS_PROG $args" > /dev/null 2>&1 &
+       _su $qa_user -c "$tmp.fsstress.bin $args" > /dev/null 2>&1 &
        _FSSTRESS_PID=$!
 
        echo "Run dd writers in parallel"
@@ -50,7 +50,9 @@ _workout()
                sleep $enospc_time
        done
 
-       _kill_fsstress
+       _pkill -PIPE -f fsstress
+       pidwait $_FSSTRESS_PID
+       return 0
 }
 
 _require_quota