]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fstests: remove uses of killall where possible
authorDave Chinner <dchinner@redhat.com>
Tue, 26 Nov 2024 20:58:47 +0000 (07:58 +1100)
committerZorro Lang <zlang@kernel.org>
Sun, 8 Dec 2024 14:10:11 +0000 (22:10 +0800)
there are many unnecessary uses of killall and stale checks for it's
existence. Parallel check execution means killall is considered
harmful, so get rid of these unneccesary uses.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Zorro lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
19 files changed:
common/config
common/fuzzy
doc/requirement-checking.txt
tests/btrfs/192
tests/btrfs/212
tests/generic/270
tests/generic/310
tests/generic/751
tests/overlay/058
tests/xfs/011
tests/xfs/013
tests/xfs/051
tests/xfs/057
tests/xfs/070
tests/xfs/079
tests/xfs/141
tests/xfs/167
tests/xfs/297
tests/xfs/442

index 70907cd3daba61e9f2a92d1fb820b3743245f569..5f86fc2c06b61eb176e938d07bc730d58d2fecde 100644 (file)
@@ -182,7 +182,6 @@ export CHACL_PROG="$(type -P chacl)"
 export ATTR_PROG="$(type -P attr)"
 export QUOTA_PROG="$(type -P quota)"
 export XFS_QUOTA_PROG="$(type -P xfs_quota)"
-export KILLALL_PROG="$(type -P killall)"
 export INDENT_PROG="$(type -P indent)"
 export XFS_COPY_PROG="$(type -P xfs_copy)"
 export FSTRIM_PROG="$(type -P fstrim)"
index 3a7f04aaebe0d8a5c8d982b056ca6fa7de563c4b..534e91dedbbb43209ba4a616bff612fe3af09519 100644 (file)
@@ -1188,14 +1188,14 @@ _scratch_xfs_stress_scrub_cleanup() {
        # a race condition that can hang fstests.
        #
        # If the xfs_io -c freeze process is asleep waiting for a write lock on
-       # s_umount or sb_write when the killall signal is delivered, it will
+       # s_umount or sb_write when the kill signal is delivered, it will
        # not check for pending signals until after it has frozen the fs.  If
        # even one thread of the stress test processes (xfs_io, fsstress, etc.)
-       # is waiting for read locks on sb_write when the killall signals are
+       # is waiting for read locks on sb_write when the kill signals are
        # delivered, they will block in the kernel until someone thaws the fs,
        # and the `wait' below will wait forever.
        #
-       # Hence we issue the killall, wait for the freezer loop to exit, thaw
+       # Hence we issue the kill, wait for the freezer loop to exit, thaw
        # the filesystem, and wait for the rest of the children.
        if [ -n "$__SCRUB_STRESS_FREEZE_PID" ]; then
                echo "Waiting for fs freezer $__SCRUB_STRESS_FREEZE_PID to exit at $(date)" >> $seqres.full
index 802bf2a3fb22117d09a1b450065e02335d7e4a10..78990fe9e3f3334c0d2081828cab26d4e762a2aa 100644 (file)
@@ -40,11 +40,11 @@ _require_command "$NAME_PROG" name
      should then be used to refer to the command when executing it.  For
      example:
 
-       _require_command "KILLALL_PROG" killall
+       _require_command "$XFS_DB_PROG" "xfs_db"
 
-     to locate the killall command and then:
+     to locate the xfs_db command and then:
 
-       $KILLALL_PROG -q $FSSTRESS_PROG
+       $XFS_DB_PROG -c "sb 0" -c "print" $SCRATCH_DEV
 
      to make use of it.
 
index cc8e1e003dadbb9e95f0f84d9cd85186153aff73..0a8ab2c1bc81eb692c871ea72d88c17f5a79f016 100755 (executable)
@@ -27,7 +27,6 @@ _cleanup()
 . ./common/dmlogwrites
 
 
-_require_command "$KILLALL_PROG" killall
 _require_command "$BLKDISCARD_PROG" blkdiscard
 _require_btrfs_fs_feature "no_holes"
 _require_btrfs_mkfs_feature "no-holes"
index 745b9598aa6b614e6d924e408e2b41f4d60cd60a..80c702720c9b91965382435eac06deec3df5e3a9 100755 (executable)
@@ -25,8 +25,6 @@ _cleanup()
 . ./common/filter
 
 _require_scratch
-_require_command "$KILLALL_PROG" killall
-
 _scratch_mkfs >> $seqres.full
 _scratch_mount
 
index aff379ac5e4cd7677b76e6f32016d294db186f77..342ac8b5d3d9638009436133d79f02becfb15265 100755 (executable)
@@ -56,7 +56,6 @@ _workout()
 _require_quota
 _require_user
 _require_scratch
-_require_command "$KILLALL_PROG" killall
 _require_command "$SETCAP_PROG" setcap
 _require_attrs security
 
index 15e87aeceb9efdab74ccf0a8a6d4545b77d5d110..1ae9e0233b5cb359adb42455b22d611903ad1e6d 100755 (executable)
@@ -29,14 +29,19 @@ _begin_fstest auto
 # Override the default cleanup function.
 _cleanup()
 {
+       if [ -n "$readdir_pid" ]; then
+               pkill --parent "$readdir_pid" t_readdir > /dev/null 2>&1
+               kill -9 $readdir_pid > /dev/null 2>&1
+               wait
+       fi
        rm -rf $TEST_DIR/tmp
+       rm -f $tmp.*
 }
 
 # Import common functions.
 . ./common/filter
 
 _require_test
-_require_command "$KILLALL_PROG" killall
 
 dmesg -c > /dev/null
 
@@ -80,9 +85,12 @@ done
 
 _test_read()
 {
-       $here/src/t_readdir_1 $SEQ_DIR &
+       $here/src/t_readdir_1 $SEQ_DIR > /dev/null 2>&1 &
+       readdir_pid=$!
        sleep $RUN_TIME
-       $KILLALL_PROG t_readdir_1
+       kill $readdir_pid
+       unset readdir_pid
+       wait
        check_kernel_bug
        if [ $? -ne 0 ]; then
                _fatal "kernel bug detected, check dmesg for more infomation."
@@ -91,9 +99,13 @@ _test_read()
 
 _test_lseek()
 {
-       $here/src/t_readdir_2 $SEQ_DIR &
+       $here/src/t_readdir_2 $SEQ_DIR > /dev/null 2>&1 &
+       readdir_pid=$!
        sleep $RUN_TIME
-       $KILLALL_PROG t_readdir_2
+       kill $readdir_pid
+       unset readdir_pid
+       wait
+
        check_kernel_bug
        if [ $? -ne 0 ]; then
                _fatal "kernel bug detected, check dmesg for more infomation."
index eac2d230a1cdb027cdec0c2e9372cd76dab34e19..892e59edff185c5a77e42321e11fef2f1969b8b9 100755 (executable)
@@ -80,7 +80,6 @@ fio_err=$tmp.fio.err
 _require_test
 _require_scratch
 _require_split_huge_pages_knob
-_require_command "$KILLALL_PROG" "killall"
 _fixed_by_git_commit kernel 2a0774c2886d \
        "XArray: set the marks correctly when splitting an entry"
 
index b70e066388d5c1905fa6ca9ad60651245c85ed5e..b19a47e368edda328a6b110535eeb3904dde64bb 100755 (executable)
@@ -21,8 +21,10 @@ _begin_fstest auto quick exportfs
 # Override the default cleanup function.
 _cleanup()
 {
-       $KILLALL_PROG -9 open_by_handle >/dev/null 2>&1
-       wait
+       if [ -n "$pids" ]; then
+               kill -9 $pids >/dev/null 2>&1
+               wait
+       fi
        cd /
        rm -f $tmp.*
 }
@@ -36,7 +38,6 @@ _require_test_program "open_by_handle"
 # We need to require all features together, because nfs_export cannot
 # be enabled when index is disabled
 _require_scratch_overlay_features index nfs_export
-_require_command "$KILLALL_PROG" killall
 
 # All overlay dirs are on scratch partition
 lower=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
@@ -89,9 +90,11 @@ test_file_handles $SCRATCH_MNT -rnp -i $tmp.lower_file_handles
 # overlay dentries in cache
 _scratch_cycle_mount "index=on,nfs_export=on"
 test_file_handles $SCRATCH_MNT -rnps -i $tmp.upper_file_handles &
+pids=$!
 # Give the above 1 second to get to sleep loop
 sleep 1
 test_file_handles $SCRATCH_MNT -rnps -i $tmp.lower_file_handles &
+pids="$pids $!"
 # Give the above 1 second to get to sleep loop
 sleep 1
 
@@ -105,8 +108,9 @@ test_file_handles $SCRATCH_MNT -rnp -i $tmp.upper_file_handles
 test_file_handles $SCRATCH_MNT -rnp -i $tmp.lower_file_handles
 
 # SIGPIPE avoids Terminated/Killed message from bash
-$KILLALL_PROG -q -13 open_by_handle
+kill -13 $pids > /dev/null 2>&1
 wait
+unset pids
 
 status=0
 exit
index ed69879c53ce3818b781a902ad3a39f10ad66ee2..1192e75dd888c613102d976a5a8c50a86322c925 100755 (executable)
@@ -14,7 +14,6 @@ _begin_fstest auto freeze log metadata quick
 _require_scratch
 _require_freeze
 _require_xfs_sysfs $(_short_dev $TEST_DEV)/log
-_require_command "$KILLALL_PROG" killall
 
 . ./common/filter
 
index c68c6ad852f0874d7e2eec1530d00ce210eae22c..fd3d8c64cd30b23892025156f49771ff1b235609 100755 (executable)
@@ -74,7 +74,6 @@ _cleaner()
 _require_scratch
 _require_xfs_mkfs_finobt
 _require_xfs_finobt
-_require_command "$KILLALL_PROG" killall
 
 _scratch_mkfs_xfs "-m crc=1,finobt=1 -d agcount=2" | \
        _filter_mkfs 2>> $seqres.full
index bb9c36da8fc426c389dda30d92ff234fabf4b078..fe3d75cab002bee6a896fad79b8b733b0227db86 100755 (executable)
@@ -19,7 +19,6 @@ _begin_fstest shutdown auto log metadata
 _require_scratch
 _require_dm_target flakey
 _require_xfs_sysfs debug/log_recovery_delay
-_require_command "$KILLALL_PROG" killall
 
 echo "Silence is golden."
 
index 62eb8b93c19f2b75d445729c504cd01cc44c9a6c..da583e6213c999654b5825971393a709716b7d6b 100755 (executable)
@@ -42,7 +42,6 @@ _cleanup()
 _require_xfs_io_error_injection log_item_pin
 _require_xfs_io_error_injection log_bad_crc
 _require_scratch
-_require_command "$KILLALL_PROG" killall
 
 echo "Silence is golden."
 
index d2bd7e2c42961d151c17023d68c3542de60e0cea..143f56888c1ec609fdd970c72cdee092f742e404 100755 (executable)
@@ -24,10 +24,10 @@ _begin_fstest auto quick repair
 # Override the default cleanup function.
 _cleanup()
 {
+       [ -n "$repair_pid" ] && kill -9 $repair_pid > /dev/null 2>&1
+       wait > /dev/null 2>&1
        cd /
        rm -f $tmp.*
-       $KILLALL_PROG -9 $XFS_REPAIR_PROG > /dev/null 2>&1
-       wait > /dev/null 2>&1
 }
 
 # Start and monitor an xfs_repair of the scratch device. This test can induce a
@@ -45,7 +45,8 @@ _xfs_repair_noscan()
        repair_pid=$!
 
        # monitor progress for as long as it is running
-       while [ `pgrep xfs_repair` ]; do
+       running=`pgrep xfs_repair`
+       while [ -n "$running" ]; do
                grep "couldn't verify primary superblock" $tmp.repair \
                        > /dev/null 2>&1
                if [ $? == 0 ]; then
@@ -58,6 +59,7 @@ _xfs_repair_noscan()
                fi
 
                sleep 1
+               running=`pgrep xfs_repair`
        done
 
        wait
@@ -72,7 +74,6 @@ _xfs_repair_noscan()
 
 # Modify as appropriate.
 _require_scratch_nocheck
-_require_command "$KILLALL_PROG" killall
 
 _scratch_mkfs | _filter_mkfs > /dev/null 2> $tmp.mkfs
 
index 794d2db4967786907e24d53a7f8e0414ab593ad4..4a1999bb87ae4f818366c952a38f2453ce0445c2 100755 (executable)
@@ -23,7 +23,6 @@ _begin_fstest shutdown auto log quick
 # Modify as appropriate.
 _require_scratch
 _require_v2log
-_require_command "$KILLALL_PROG" killall
 
 echo "Silence is golden."
 
index b630ba10db0e0fcc7f64a36facb7f33dc8548703..6aa8448257e343d4f0b3c6d691d5a986dd6c662b 100755 (executable)
@@ -20,7 +20,6 @@ _begin_fstest auto log metadata
 # Modify as appropriate.
 _require_xfs_io_error_injection "log_bad_crc"
 _require_scratch
-_require_command "$KILLALL_PROG" killall
 
 echo "Silence is golden."
 
index 5ef2aa2ea0839de8c7e44a3e3346f7da48cc9618..2a6e6b8d039d8eb63c9f68f32e74027095d4129f 100755 (executable)
@@ -21,10 +21,7 @@ workout()
 # Import common functions.
 . ./common/filter
 
-
-_require_command "$KILLALL_PROG" killall
 _require_xfs_io_command "falloc"
-
 _require_scratch
 _scratch_mkfs_xfs >/dev/null 2>&1
 _scratch_mount
index 66c5d0cc710f65652825df29fc335ef99402b3f4..f9cd2ff128137acbcf1d77f9d17f0ad8aaede23f 100755 (executable)
@@ -24,10 +24,8 @@ _cleanup()
 # Import common functions.
 . ./common/filter
 
-
 _require_scratch
 _require_freeze
-_require_command "$KILLALL_PROG" killall
 
 logblks=$(_scratch_find_xfs_min_logblocks -d agcount=16,su=256k,sw=12 -l su=256k)
 _scratch_mkfs_xfs -d agcount=16,su=256k,sw=12 -l su=256k,size=${logblks}b >/dev/null 2>&1
index d539fa5e0238188cc66e033facfba0b8202c1484..08f0aac40433ee114b39c4a49b50e6098efbc1e4 100755 (executable)
@@ -21,7 +21,6 @@ _begin_fstest auto stress clone quota
 
 _require_scratch_reflink
 _require_quota
-_require_command "$KILLALL_PROG" "killall"
 
 report_quota_blocks() {
        $XFS_QUOTA_PROG -x -c "report $1" $SCRATCH_MNT | \