selftests: mptcp: make sendfile selftest work
Subsystems (3)
PATCH v2 1/1 selftests: mptcp: make sendfile selftest work
When the selftest got added, sendfile() on mptcp sockets returned -EOPNOTSUPP, so running 'mptcp_connect.sh -m sendfile' failed immediately.
This is no longer the case, but the script fails anyway due to timeout. Let the receiver know once the sender has sent all data, just like with '-m mmap' mode.
v2: need to respect cfg_wait too, as pm_userspace.sh relied on -m sendfile to keep the connection open (Mat Martineau)
--- .../selftests/net/mptcp/mptcp_connect.c | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +17 -9
@@ -553,6 +553,18 @@ static void set_nonblock(int fd, bool nonblock)fcntl (fd,F_SETFL , flags & ~O_NONBLOCK ); } +static void shut_wr (int fd) +{ +/* Close our write side, ev. give some time +* for address notification and/or checking +* the current status +*/ +if (cfg_wait) +usleep (cfg_wait); + +shutdown (fd,SHUT_WR ); +} +static int copyfd_io_poll (int infd,int peerfd,int outfd,bool *in_closed_after_out) {struct pollfd fds = {
@@ -630,14 +642,7 @@ static int copyfd_io_poll(int infd, int peerfd, int outfd, bool *in_closed_after/* ... and peer also closed already */ break ; -/* ... but we still receive. -* Close our write side, ev. give some time -* for address notification and/or checking -* the current status -*/ -if (cfg_wait) -usleep (cfg_wait); -shutdown (peerfd,SHUT_WR ); +shut_wr (peerfd); }else {if (errno ==EINTR )continue ;
@@ -767,7 +772,7 @@ static int copyfd_io_mmap(int infd, int peerfd, int outfd,if (err)return err; -shutdown (peerfd,SHUT_WR ); +shut_wr (peerfd); err =do_recvfile (peerfd, outfd); *in_closed_after_out = true;
@@ -791,6 +796,9 @@ static int copyfd_io_sendfile(int infd, int peerfd, int outfd, err =do_sendfile (infd, peerfd, size);if (err)return err; + +shut_wr (peerfd); + err =do_recvfile (peerfd, outfd); *in_closed_after_out = true; }
Signature · 1 line
2.35.1
Re: selftests: mptcp: make sendfile selftest work: Tests Results
Hi Florian,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal:
- Unstable: 2 failed test(s): selftest_mptcp_join selftest_simult_flows 🔴:
- Task: https://cirrus-ci.com/task/5322407467548672
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5322407467548672/summary/summary.txt
- KVM Validation: debug:
- Success! ✅:
- Task: https://cirrus-ci.com/task/6448307374391296
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6448307374391296/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/1b04f2259a4c
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-debugFor 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 (Tessares)
Quoted 8 lines · Florian Westphal
When the selftest got added,
sendfile()on mptcp sockets returned-EOPNOTSUPP, so running 'mptcp_connect.sh-m sendfile' failed immediately.This is no longer the case, but the script fails anyway due to timeout. Let the receiver know once the sender has sent all data, just like with '-m mmap' mode.
Quoted 6 lines
v2: need to respect
cfg_waittoo, aspm_userspace.shrelied on -m sendfile to keep the connection open (Mat Martineau)Fixes 048d19d444be ("mptcp: add basic kselftest for mptcp")Reported-by Xiumei Mu <[email protected]>Signed-off-by Florian Westphal <[email protected]>
Looks good to me, tests run fine on my system. I tried to reproduce the failures that CI reported on the non-debug build but so far it doesn't look like this change caused those failures.
With the Fixes: tag I assume this is intended for -net?
Quoted 66 lines
---
.../selftests/net/mptcp/mptcp_connect.c| 26 ++++++++++++-------1 file changed, 17 insertions(+), 9 deletions(-)tools/testing/selftests/net/mptcp/mptcp_connect.c +17
-9@@ -553,6 +553,18 @@ static void set_nonblock(int fd, bool nonblock)fcntl (fd,F_SETFL , flags & ~O_NONBLOCK ); } +static void shut_wr (int fd) +{ +/* Close our write side, ev. give some time +* for address notification and/or checking +* the current status +*/ +if (cfg_wait) +usleep (cfg_wait); + +shutdown (fd,SHUT_WR ); +} +static int copyfd_io_poll (int infd,int peerfd,int outfd,bool *in_closed_after_out) {struct pollfd fds = {@@ -630,14 +642,7 @@ static int copyfd_io_poll(int infd, int peerfd, int outfd, bool *in_closed_after/* ... and peer also closed already */ break ; -/* ... but we still receive. -* Close our write side, ev. give some time -* for address notification and/or checking -* the current status -*/ -if (cfg_wait) -usleep (cfg_wait); -shutdown (peerfd,SHUT_WR ); +shut_wr (peerfd); }else {if (errno ==EINTR )continue ;@@ -767,7 +772,7 @@ static int copyfd_io_mmap(int infd, int peerfd, int outfd,if (err)return err; -shutdown (peerfd,SHUT_WR ); +shut_wr (peerfd); err =do_recvfile (peerfd, outfd); *in_closed_after_out = true;@@ -791,6 +796,9 @@ static int copyfd_io_sendfile(int infd, int peerfd, int outfd, err =do_sendfile (infd, peerfd, size);if (err)return err; + +shut_wr (peerfd); + err =do_recvfile (peerfd, outfd); *in_closed_after_out = true; }Signature · 1 line
2.35.1
--
Mat Martineau
Intel
Quoted 3 lines · Mat Martineau
Looks good to me, tests run fine on my system. I tried to reproduce the failures that CI reported on the non-debug build but so far it doesn't look like this change caused those failures.
Thanks for reviewing.
Quoted 1 line
With the Fixes: tag I assume this is intended for -net?
Yes, its intended for -net.
Hi Florian, Mat,
Quoted 10 lines · Florian Westphal
When the selftest got added,
sendfile()on mptcp sockets returned-EOPNOTSUPP, so running 'mptcp_connect.sh-m sendfile' failed immediately.This is no longer the case, but the script fails anyway due to timeout. Let the receiver know once the sender has sent all data, just like with '-m mmap' mode.
v2: need to respect
cfg_waittoo, aspm_userspace.shrelied on -m sendfile to keep the connection open (Mat Martineau)
Thank you for the patch and the review!
Now in our tree (fix for -net) with Mat's RvB tag:
New patches for t/upstream-net:
- febacb9a6dd6: selftests: mptcp: make sendfile selftest work
- Results: 17273797344c..06a049f34010 (export-net)
New patches for t/upstream:
- febacb9a6dd6: selftests: mptcp: make sendfile selftest work
- Results: ba0f79895fde..7f8f198f2f9b (export)
Tests are now in progress:
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export-net/20220803T163309
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220803T163309
Cheers,
Matt
Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions www.tessares.net