public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] selftests: net: lib: kill PIDs before del netns
@ 2024-08-13 13:39 Matthieu Baerts (NGI0)
  2024-08-13 14:07 ` Florian Westphal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Matthieu Baerts (NGI0) @ 2024-08-13 13:39 UTC (permalink / raw)
  To: mptcp, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Shuah Khan, Hangbin Liu, Petr Machata
  Cc: netdev, linux-kselftest, linux-kernel, Mat Martineau,
	Matthieu Baerts (NGI0)

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: 25ae948b4478 ("selftests/net: add lib.sh")
Acked-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 tools/testing/selftests/net/lib.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh
index d0219032f773..8ee4489238ca 100644
--- a/tools/testing/selftests/net/lib.sh
+++ b/tools/testing/selftests/net/lib.sh
@@ -146,6 +146,7 @@ cleanup_ns()
 
 	for ns in "$@"; do
 		[ -z "${ns}" ] && continue
+		ip netns pids "${ns}" 2> /dev/null | xargs -r kill || true
 		ip netns delete "${ns}" &> /dev/null || true
 		if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then
 			echo "Warn: Failed to remove namespace $ns"

---
base-commit: 58a63729c957621f1990c3494c702711188ca347
change-id: 20240813-upstream-net-20240813-selftests-net-lib-kill-f7964a3a58fe

Best regards,
-- 
Matthieu Baerts (NGI0) <matttbe@kernel.org>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] selftests: net: lib: kill PIDs before del netns
  2024-08-13 13:39 [PATCH net] selftests: net: lib: kill PIDs before del netns Matthieu Baerts (NGI0)
@ 2024-08-13 14:07 ` Florian Westphal
  2024-08-14  2:11 ` Hangbin Liu
  2024-08-15 11:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Westphal @ 2024-08-13 14:07 UTC (permalink / raw)
  To: Matthieu Baerts (NGI0)
  Cc: mptcp, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Shuah Khan, Hangbin Liu, Petr Machata, netdev, linux-kselftest,
	linux-kernel, Mat Martineau

Matthieu Baerts (NGI0) <matttbe@kernel.org> wrote:
> 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".

Thanks, this makes sense to me.

Acked-by: Florian Westphal <fw@strlen.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] selftests: net: lib: kill PIDs before del netns
  2024-08-13 13:39 [PATCH net] selftests: net: lib: kill PIDs before del netns Matthieu Baerts (NGI0)
  2024-08-13 14:07 ` Florian Westphal
@ 2024-08-14  2:11 ` Hangbin Liu
  2024-08-15 11:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Hangbin Liu @ 2024-08-14  2:11 UTC (permalink / raw)
  To: Matthieu Baerts (NGI0)
  Cc: mptcp, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Shuah Khan, Petr Machata, netdev, linux-kselftest, linux-kernel,
	Mat Martineau

On Tue, Aug 13, 2024 at 03:39:34PM +0200, Matthieu Baerts (NGI0) wrote:
> 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: 25ae948b4478 ("selftests/net: add lib.sh")
> Acked-by: Mat Martineau <martineau@kernel.org>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
>  tools/testing/selftests/net/lib.sh | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh
> index d0219032f773..8ee4489238ca 100644
> --- a/tools/testing/selftests/net/lib.sh
> +++ b/tools/testing/selftests/net/lib.sh
> @@ -146,6 +146,7 @@ cleanup_ns()
>  
>  	for ns in "$@"; do
>  		[ -z "${ns}" ] && continue
> +		ip netns pids "${ns}" 2> /dev/null | xargs -r kill || true
>  		ip netns delete "${ns}" &> /dev/null || true
>  		if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then
>  			echo "Warn: Failed to remove namespace $ns"
> 
> ---
> base-commit: 58a63729c957621f1990c3494c702711188ca347
> change-id: 20240813-upstream-net-20240813-selftests-net-lib-kill-f7964a3a58fe
> 
> Best regards,
> -- 
> Matthieu Baerts (NGI0) <matttbe@kernel.org>
> 

Thanks for the fix

Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] selftests: net: lib: kill PIDs before del netns
  2024-08-13 13:39 [PATCH net] selftests: net: lib: kill PIDs before del netns Matthieu Baerts (NGI0)
  2024-08-13 14:07 ` Florian Westphal
  2024-08-14  2:11 ` Hangbin Liu
@ 2024-08-15 11:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-15 11:20 UTC (permalink / raw)
  To: Matthieu Baerts
  Cc: mptcp, davem, edumazet, kuba, pabeni, shuah, liuhangbin, petrm,
	netdev, linux-kselftest, linux-kernel, martineau

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue, 13 Aug 2024 15:39:34 +0200 you wrote:
> 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".
> 
> [...]

Here is the summary with links:
  - [net] selftests: net: lib: kill PIDs before del netns
    https://git.kernel.org/netdev/net/c/7965a7f32a53

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-15 11:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-13 13:39 [PATCH net] selftests: net: lib: kill PIDs before del netns Matthieu Baerts (NGI0)
2024-08-13 14:07 ` Florian Westphal
2024-08-14  2:11 ` Hangbin Liu
2024-08-15 11:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox