selftests: mptcp: add close function in main_loop_s function
Subsystems (3)
Matthieu Baerts (NGI0)
maintainerPATCH 1/1 selftests: mptcp: add close function in main_loop_s function
From: Liu Jing <[email protected]>
in main_loop_s function, when open(cfg_input, O_RDONLY),When the open(cfg_input, O_RDONLY) function is run, the last fd file descriptor is not closed if the if (--cfg_repeat > 0) branch is not taken
--- tools/testing/selftests/net/mptcp/mptcp_connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +2 -1
@@ -1119,7 +1119,8 @@ int main_loop_s(int listensock)if (cfg_input)close (fd); goto again; - } + }else +close (fd);return 0 ; }
Signature · 1 line
2.45.2
Matthieu Baerts
maintainerHi Liu Jing,
Thank you for this patch.
I have some comments, please see below. Can you send a v2 please?
Please send such patches to MPTCP mailing list, as mentioned in the MAINTAINERS file: for us to be able to track and review these patches. And for our CI to validate them.
Quoted 3 lines · On 01/07/2024 20:16, Matthieu Baerts (NGI0) wrote:
From: Liu Jing <[email protected]>
in
main_loop_sfunction, whenopen(cfg_input, O_RDONLY),When theopen(cfg_input, O_RDONLY)function is run,
"when open(cfg_input, O_RDONLY)" is duplicated.
Quoted 1 line
the last fd file descriptor is not closed if the if (--cfg_repeat > 0) branch is not taken
Could you limit the lines to max 72 chars for the description and around ~50 for the title please?
selftests: mptcp: always close input's FD if opened
Also, it looks like it is a bug-fix. Then please add a 'Fixes' tag, e.g.:
Quoted 2 lines
Signed-off-by Liu Jing <[email protected]>Signed-off-by Matthieu Baerts (NGI0) <[email protected]>
(In your v2, please drop my SoB that has been automatically added when sending this patch to our ML)
Quoted 9 lines
--- tools/testing/selftests/net/mptcp/mptcp_connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/net/mptcp/mptcp_connect.c +0
-0
tools/testing/selftests/net/mptcp/mptcp_connect.c int main_loop_s(int listensock) · line 1123
Quoted 6 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +2
-1@@ -1119,7 +1119,8 @@ int main_loop_s(int listensock)if (cfg_input)close (fd); goto again; - } + }else +close (fd);
I think it would be clearer to move...
if (cfg_input)
close(fd);... before 'if (--cfg_repeat > 0)' (with an empty line in between): so first we 'close(fd)' if needed, then we check if we need to do it again.
Note: Please run 'checkpatch.pl': it was complaining about this line:
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/9749324582
tools/testing/selftests/net/mptcp/mptcp_connect.c int main_loop_s(int listensock) · line 1126
Quoted 3 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +0
-0return 0 ; }
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Hi Liu,
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 (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/9749324571
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/27aea1e315d8
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=867250
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)