cleanups for main_loop
Subsystems (3)
Geliang Tang
reviewerv2 cover cleanups for main_loop
From: Geliang Tang <[email protected]>
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.
Based-on: <59caf78b9d67a0a61a19a46f7820456f6ced3d6e.1742296236.git.tanggeliang@kylinos.cn>
v1:
- https://patchwork.kernel.org/project/mptcp/cover/[email protected]/
Geliang Tang (2):
selftests: mptcp: open cfg_input once in main_loop
selftests: mptcp: close fds when copyfd_io fails
.../testing/selftests/net/mptcp/mptcp_connect.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
Signature · 1 line
2.43.0
Geliang Tang
reviewerPATCH v2 1/2 selftests: mptcp: open cfg_input once in main_loop
From: Geliang Tang <[email protected]>
cfg_input is opened twice regardless of whether cfg_sockopt_types.mptfo is configured. This can be simplified to open it once at the beginning of main_loop() and close it at the end, because no need to repeatedly open and close cfg_input during cfg_repeat.
--- tools/testing/selftests/net/mptcp/mptcp_connect.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +3 -9
@@ -1268,7 +1268,7 @@ int main_loop(void)struct addrinfo *peer;struct wstate winfo; -if (cfg_input && cfg_sockopt_types.mptfo) { +if (cfg_input) { fd_in =open (cfg_input,O_RDONLY );if (fd_in <0 )xerror ("can't open %s:%d" , cfg_input, errno);
@@ -1291,12 +1291,6 @@ int main_loop(void)if (cfg_cmsg_types.cmsg_enabled)apply_cmsg_types (fd, &cfg_cmsg_types); -if (cfg_input && !cfg_sockopt_types.mptfo) { - fd_in =open (cfg_input,O_RDONLY ); -if (fd_in <0 ) -xerror ("can't open %s:%d" , cfg_input, errno); - } - ret =copyfd_io (fd_in, fd,1 ,0 , &winfo);if (ret)return ret;
@@ -1312,14 +1306,14 @@ int main_loop(void)set_nonblock (fd, false);if (connect (fd, peer->ai_addr, peer->ai_addrlen))xerror ("can't reconnect: %d" , errno); -if (cfg_input) -close (fd_in);memset (&winfo,0 ,sizeof (winfo)); goto again; }else {close (fd); } +if (cfg_input) +close (fd_in);return 0 ; }
Signature · 1 line
2.43.0
Geliang Tang
reviewerPATCH v2 2/2 selftests: mptcp: close fds when copyfd_io fails
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
When copyfd_io fails, it should not simply return an error, but should close all open file descriptors before that. Here an "out" tag is added to do this.
--- tools/testing/selftests/net/mptcp/mptcp_connect.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +3 -2
@@ -1293,7 +1293,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 );
@@ -1309,12 +1309,13 @@ int main_loop(void)memset (&winfo,0 ,sizeof (winfo)); goto again; }else { +out:close (fd); }if (cfg_input)close (fd_in); -return 0 ; +return ret; }int parse_proto (const char *proto)
Signature · 1 line
2.43.0
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Unstable: 1 failed test(s): selftest_mptcp_connect 🔴
- KVM Validation: debug: Unstable: 1 failed test(s): selftest_mptcp_connect 🔴
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/13938550896
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/ee7ab4397474
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=945419
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-normalFor 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)
Geliang Tang
reviewerQuoted 10 lines · MPTCP CI
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Unstable: 1 failed test(s):
selftest_mptcp_connect🔴
- KVM Validation: debug: Unstable: 1 failed test(s):selftest_mptcp_connect🔴
Oops, I fixed this in v3.
Thanks,
-Geliang
Quoted 39 lines
- KVM Validation: btf-normal (only
bpftest_all): Success! ✅
- KVM Validation: btf-debug (onlybpftest_all): Success! ✅
- Task:
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/13938550896Initiator: Patchew Applier
Commits:
https://github.com/multipath-tcp/mptcp_net-next/commits/ee7ab4397474
Patchwork:
https://patchwork.kernel.org/project/mptcp/list/?series=945419If 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-normalFor 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)