Re: [PATCH mptcp-next 2/2] selftests: mptcp: simult_flows: set EXIT trap earlier

[email protected] Fri, 24 Jul 2026 09:52:52 +0000
Newsgroups dev.linux.lists.mptcp
Message-ID <[email protected]>
July 24, 2026 at 5:27 PM, "Matthieu Baerts" <[email protected] mailto:[email protected]?to=%22Matthieu%20Baerts%22%20%3Cmatttbe%40kernel.org%3E > wrote:


> 
> Hi Gang,
> 
> On 24/07/2026 08:52, Gang Yan wrote:
> 
> > 
> > From: Gang Yan <[email protected]>
> >  
> >  Set the EXIT trap for cleanup immediately after creating the temporary
> >  file variables, before the dd commands that fill them and the namespace
> >  init, to ensure cleanup runs on any failure or interruption during the
> >  early setup phase. If either dd fails (e.g. ENOSPC), the temp files
> >  already created are not cleaned up.
> > 
> From what I see, if one of the 'dd' command fails, the errors are simply
> ignored.
> 
> > 
> > Assisted-by: Codex: GLM-5.2
> >  Signed-off-by: Gang Yan <[email protected]>
> >  ---
> >  tools/testing/selftests/net/mptcp/simult_flows.sh | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >  
> >  diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh
> >  index 3ea3d1efe32e..b40dea5f9b30 100755
> >  --- a/tools/testing/selftests/net/mptcp/simult_flows.sh
> >  +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh
> >  @@ -62,13 +62,12 @@ setup()
> >  sout=$(mktemp)
> >  cout=$(mktemp)
> >  capout=$(mktemp)
> >  + trap cleanup EXIT
> >  size=$((2 * 2048 * 4096))
> >  
> >  dd if=/dev/zero of=$small bs=4096 count=20 >/dev/null 2>&1
> >  dd if=/dev/zero of=$large bs=4096 count=$((size / 4096)) >/dev/null 2>&1
> > 
> This 'fix' is only interesting when the script is abort while one of the
> dd command is in progress, to create files of 80k and 16M in RAM. I
> guess this is very unlikely, no?

Hi Matt,

This change was suggested by AI, referencing commit c8da80af2838 ("selftests: mptcp:
sockopt: set EXIT trap earlier").

I agree the problematic case is unlikely to hit in practice. My main motivation is
to keep the selftest scripts consistent.

If left unfixed, someone might spot this later and send another similar patch,
bringing extra review overhead in the future.

But I am still okay dropping this patch.

Cheers,
Gang


> 
> If you already managed to end-up in this situation by accident, OK to
> accept the change, but the commit message needs to be updated.
> 
> If it is a potential fix for an unlikely situation with the selftests,
> we probably don't need that.
> 
> Cheers,
> Matt
> -- 
> Sponsored by the NGI0 Core fund.
>