Skip to content

Commit 7965a7f

Browse files
matttbePaolo Abeni
authored andcommitted
selftests: net: lib: kill PIDs before del netns
When deleting netns, it is possible to still have some tasks running, e.g. background tasks like tcpdump running in the background, not stopped because the test has been interrupted. Before deleting the netns, it is then safer to kill all attached PIDs, if any. That should reduce some noises after the end of some tests, and help with the debugging of some issues. That's why this modification is seen as a "fix". Fixes: 25ae948 ("selftests/net: add lib.sh") Acked-by: Mat Martineau <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Acked-by: Florian Westphal <[email protected]> Reviewed-by: Hangbin Liu <[email protected]> Link: https://patch.msgid.link/20240813-upstream-net-20240813-selftests-net-lib-kill-v1-1-27b689b248b8@kernel.org Signed-off-by: Paolo Abeni <[email protected]>
1 parent cdc90f7 commit 7965a7f

File tree

1 file changed

+1
-0
lines changed
  • tools/testing/selftests/net

1 file changed

+1
-0
lines changed

tools/testing/selftests/net/lib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ cleanup_ns()
146146

147147
for ns in "$@"; do
148148
[ -z "${ns}" ] && continue
149+
ip netns pids "${ns}" 2> /dev/null | xargs -r kill || true
149150
ip netns delete "${ns}" &> /dev/null || true
150151
if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then
151152
echo "Warn: Failed to remove namespace $ns"

0 commit comments

Comments
 (0)