Patch "selftests: pmtu.sh: Kill nettest processes launched in subshell." has been added to the 5.16-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    selftests: pmtu.sh: Kill nettest processes launched in subshell.

to the 5.16-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     selftests-pmtu.sh-kill-nettest-processes-launched-in.patch
and it can be found in the queue-5.16 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c4b5881b368fb057759441332f2e9e3073c606aa
Author: Guillaume Nault <gnault@xxxxxxxxxx>
Date:   Tue Mar 8 23:15:03 2022 +0100

    selftests: pmtu.sh: Kill nettest processes launched in subshell.
    
    [ Upstream commit 94a4a4fe4c696413932eed8bdec46574de9576b8 ]
    
    When using "run_cmd <command> &", then "$!" refers to the PID of the
    subshell used to run <command>, not the command itself. Therefore
    nettest_pids actually doesn't contain the list of the nettest commands
    running in the background. So cleanup() can't kill them and the nettest
    processes run until completion (fortunately they have a 5s timeout).
    
    Fix this by defining a new command for running processes in the
    background, for which "$!" really refers to the PID of the command run.
    
    Also, double quote variables on the modified lines, to avoid shellcheck
    warnings.
    
    Fixes: ece1278a9b81 ("selftests: net: add ESP-in-UDP PMTU test")
    Signed-off-by: Guillaume Nault <gnault@xxxxxxxxxx>
    Reviewed-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
index 2e8972573d91..694732e4b344 100755
--- a/tools/testing/selftests/net/pmtu.sh
+++ b/tools/testing/selftests/net/pmtu.sh
@@ -374,6 +374,16 @@ run_cmd() {
 	return $rc
 }
 
+run_cmd_bg() {
+	cmd="$*"
+
+	if [ "$VERBOSE" = "1" ]; then
+		printf "    COMMAND: %s &\n" "${cmd}"
+	fi
+
+	$cmd 2>&1 &
+}
+
 # Find the auto-generated name for this namespace
 nsname() {
 	eval echo \$NS_$1
@@ -670,10 +680,10 @@ setup_nettest_xfrm() {
 	[ ${1} -eq 6 ] && proto="-6" || proto=""
 	port=${2}
 
-	run_cmd ${ns_a} nettest ${proto} -q -D -s -x -p ${port} -t 5 &
+	run_cmd_bg "${ns_a}" nettest "${proto}" -q -D -s -x -p "${port}" -t 5
 	nettest_pids="${nettest_pids} $!"
 
-	run_cmd ${ns_b} nettest ${proto} -q -D -s -x -p ${port} -t 5 &
+	run_cmd_bg "${ns_b}" nettest "${proto}" -q -D -s -x -p "${port}" -t 5
 	nettest_pids="${nettest_pids} $!"
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux