]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
fuzzy: kill subprocesses with SIGPIPE, not SIGINT
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Feb 2025 22:00:27 +0000 (14:00 -0800)
committerZorro Lang <zlang@kernel.org>
Tue, 18 Feb 2025 04:42:39 +0000 (12:42 +0800)
The next patch in this series fixes various issues with the recently
added fstests process isolation scheme by running each new process in a
separate process group session.  Unfortunately, the processes in the
session are created with SIGINT ignored by default because they are not
attached to the controlling terminal.  Therefore, switch the kill signal
to SIGPIPE because that is usually fatal and not masked by default.

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/fuzzy

index 0a2d91542b561e684e32f975ac6e0129bb1e42a3..4dea96b9aa3cce5eb777f7f6ace79eb0c83f2a90 100644 (file)
@@ -891,7 +891,7 @@ __stress_xfs_scrub_loop() {
        local runningfile="$2"
        local scrub_startat="$3"
        shift; shift; shift
-       local sigint_ret="$(( $(kill -l SIGINT) + 128 ))"
+       local signal_ret="$(( $(kill -l SIGPIPE) + 128 ))"
        local scrublog="$tmp.scrub"
 
        while __stress_scrub_running "$scrub_startat" "$runningfile"; do
@@ -901,8 +901,8 @@ __stress_xfs_scrub_loop() {
        while __stress_scrub_running "$end" "$runningfile"; do
                _scratch_scrub "$@" &> $scrublog
                res=$?
-               if [ "$res" -eq "$sigint_ret" ]; then
-                       # Ignore SIGINT because the cleanup function sends
+               if [ "$res" -eq "$signal_ret" ]; then
+                       # Ignore SIGPIPE because the cleanup function sends
                        # that to terminate xfs_scrub
                        res=0
                fi
@@ -1173,13 +1173,11 @@ _scratch_xfs_stress_scrub_cleanup() {
        rm -f "$runningfile"
        echo "Cleaning up scrub stress run at $(date)" >> $seqres.full
 
-       # Send SIGINT so that bash won't print a 'Terminated' message that
-       # distorts the golden output.
        echo "Killing stressor processes at $(date)" >> $seqres.full
        _kill_fsstress
-       pkill -INT --parent $$ xfs_io >> $seqres.full 2>&1
-       pkill -INT --parent $$ fsx >> $seqres.full 2>&1
-       pkill -INT --parent $$ xfs_scrub >> $seqres.full 2>&1
+       pkill -PIPE --parent $$ xfs_io >> $seqres.full 2>&1
+       pkill -PIPE --parent $$ fsx >> $seqres.full 2>&1
+       pkill -PIPE --parent $$ 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
@@ -1209,6 +1207,7 @@ _scratch_xfs_stress_scrub_cleanup() {
        # Wait for the remaining children to exit.
        echo "Waiting for children to exit at $(date)" >> $seqres.full
        wait
+       echo "Children exited as of $(date)" >> $seqres.full
 
        # Ensure the scratch fs is also writable before we exit.
        if [ -n "$__SCRUB_STRESS_REMOUNT_LOOP" ]; then