Skip to contentSkip to conversation

cleanups for main_loop

PATCH In review Geliang Tang 3 participants 5 messages Mar 19, 2025 – Mar 20, 2025

Subsystems (3)
lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

v3 cover cleanups for main_loop

From: Geliang Tang <[email protected]>

v3:
- don't remove the second "open(cfg_input)", it breaks the disconnect tests.
- no need to "close(fd)" when copyfd_io fails.

Based-on: <59caf78b9d67a0a61a19a46f7820456f6ced3d6e.1742296236.git.tanggeliang@kylinos.cn>

v2:
- update the pending patches from Cong Liu, he said to me that he has
no time to deal with this recently.
- delete the second "open(cfg_input)" instead of the first one as Matt suggested.
- drop freeaddrinfo, no need to do this.
- https://patchwork.kernel.org/project/mptcp/cover/[email protected]/

v1:
- https://patchwork.kernel.org/project/mptcp/cover/[email protected]/

Geliang Tang (1):
selftests: mptcp: close fd_in before returning in main_loop

 tools/testing/selftests/net/mptcp/mptcp_connect.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0
author reviewer
#1 lore raw

PATCH v3 1/1 selftests: mptcp: close fd_in before returning in main_loop

From: Geliang Tang <[email protected]>

The file descriptor 'fd_in' is opened when cfg_input is configured, but not closed in main_loop(), this patch fixes it.

Fixes 05be5e273c84 ("selftests: mptcp: add disconnect tests")
---
 tools/testing/selftests/net/mptcp/mptcp_connect.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +5 -2
index 893dc36b12f6..c83a8b47bbdf 100644
@@ -1299,7 +1299,7 @@ int main_loop(void)
 
 	ret = copyfd_io(fd_in, fd, 1, 0, &winfo);
 	if (ret)
-		return ret;
+		goto out;
 
 	if (cfg_truncate > 0) {
 		shutdown(fd, SHUT_WR);
@@ -1320,7 +1320,10 @@ int main_loop(void)
 		close(fd);
 	}
 
-	return 0;
+out:
+	if (cfg_input)
+		close(fd_in);
+	return ret;
 }
 
 int parse_proto(const char *proto)
Signature · 1 line
2.43.0
#3 lore raw
In reply to Geliang Tang

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Unstable: 1 failed test(s): bpftest_test_progs-no_alu32_mptcp 🔴
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/13940254304

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/2e5015f77aff
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=945438

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)

maintainer Reviewed-by on v3 1/1
#2 lore raw

Re: [PATCH mptcp-next v3 1/1] selftests: mptcp: close fd_in before returning in main_loop

In reply to Geliang Tang

Hi Geliang, Cong,

Quoted 4 lines · Geliang Tang

From: Geliang Tang <[email protected]>

The file descriptor 'fd_in' is opened when cfg_input is configured, but not closed in main_loop(), this patch fixes it.

Thank you for the new version, it looks good to me (for -net):

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
maintainer
#4 lore raw
In reply to Geliang Tang

Hi Geliang,

Quoted 6 lines · Geliang Tang

From: Geliang Tang <[email protected]>

v3:
- don't remove the second "open(cfg_input)", it breaks the disconnect tests.
- no need to "close(fd)" when copyfd_io fails.

Thank you for the v3!

Now in our tree (fixes for -net)

New patches for t/upstream-net and t/upstream:
- 13f5f942f351: selftests: mptcp: close fd_in before returning in main_loop
- Results: d875e1a7561c..d9132f531a99 (export-net)
- Results: 148c72298499..f919d66019d7 (export)

Tests are now in progress:

- export-net:
https://github.com/multipath-tcp/mptcp_net-next/commit/bf609846189a78f7c1b12715143f53e747f9798e/checks
- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/6b987b570b6ee0670d23bb5dd7d9d14ae680ac9c/checks

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.