Squash to "implement mptcp read_sock" v8
Subsystems (2)
Geliang Tang
reviewerv2 cover Squash to "implement mptcp read_sock" v8
From: Geliang Tang <[email protected]>
v2:
- use mptcp_recv_should_stop instead of
if (sk->sk_err || sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN) || !timeo || signal_pending(current))
in mptcp_recvmsg.
- use mptcp_recv_should_stop instead of
if (sk->sk_err || sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN) || signal_pending(current))
in mptcp_splice_read.
v1:
Drop "shutdown" parameter of mptcp_recv_should_stop.
Based-on: <[email protected]>
Geliang Tang (2):
Squash to "mptcp: add recv_should_stop helper"
Squash to "mptcp: implement .splice_read"
net/mptcp/protocol.c | 59 +++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 31 deletions(-)
Signature · 1 line
2.48.1
Geliang Tang
reviewerPATCH v2 1/2 Squash to "mptcp: add recv_should_stop helper"
From: Geliang Tang <[email protected]>
Drop "shutdown" parameter of mptcp_recv_should_stop. Use mptcp_recv_should_stop for "if (copied)" case too.
--- net/mptcp/protocol.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-)
net/mptcp/protocol.c +17 -22
@@ -2090,20 +2090,13 @@ static unsigned int mptcp_inq_hint(const struct sock *sk)return 0 ; } -static int mptcp_recv_should_stop (struct sock *sk,long timeo,int *shutdown) +static int mptcp_recv_should_stop (struct sock *sk,long timeo) {if (sk->sk_err)return sock_error (sk); -if (sk->sk_shutdown &RCV_SHUTDOWN ) { - *shutdown =1 ; -/* race breaker: the shutdown could be after the -* previous receive queue check -*/ -if (__mptcp_move_skbs (sk)) - *shutdown =0 ; -return 0 ; - } +if (sk->sk_shutdown &RCV_SHUTDOWN ) +return -ESHUTDOWN ;if (sk->sk_state ==TCP_CLOSE )return -ENOTCONN ;
@@ -2123,7 +2116,6 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,struct mptcp_sock *msk =mptcp_sk (sk);struct scm_timestamping_internal tss;int copied =0 , cmsg_flags =0 ; -int shutdown =-1 ;int target;long timeo;
@@ -2166,19 +2158,22 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,if (copied >= target)break ; -if (copied) { -if (sk->sk_err || - sk->sk_state ==TCP_CLOSE || - (sk->sk_shutdown &RCV_SHUTDOWN ) || - !timeo || -signal_pending (current)) + err =mptcp_recv_should_stop (sk, timeo); +if (err <0 ) { +if (copied)break ; - }else { - copied =mptcp_recv_should_stop (sk, timeo, &shutdown); -if (copied <0 || shutdown ==1 ) + +if (err == -ESHUTDOWN ) { +/* race breaker: the shutdown could be after the +* previous receive queue check +*/ +if (__mptcp_move_skbs (sk)) +continue ;break ; -if (shutdown ==0 ) -continue ; + } + + copied = err; +break ; }pr_debug ("block timeout %ld\n" , timeo);
Signature · 1 line
2.48.1
Geliang Tang
reviewerPATCH v2 2/2 Squash to "mptcp: implement .splice_read"
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
Update the parameter of mptcp_recv_should_stop. Use mptcp_recv_should_stop at the end of the main loop too.
--- net/mptcp/protocol.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
net/mptcp/protocol.c +11 -9
@@ -4056,10 +4056,9 @@ static ssize_t mptcp_splice_read(struct socket *sock, loff_t *ppos, .flags = flags, };struct sock *sk = sock->sk; -int shutdown =-1 ;ssize_t spliced; +int ret, err;long timeo; -int ret;/* * We can't seek on a socket input
@@ -4082,11 +4081,16 @@ static ssize_t mptcp_splice_read(struct socket *sock, loff_t *ppos,break ;if (sock_flag (sk,SOCK_DONE ))break ; - ret =mptcp_recv_should_stop (sk, timeo, &shutdown); -if (ret <0 || shutdown ==1 ) + err =mptcp_recv_should_stop (sk, timeo); +if (err <0 ) { +if (err == -ESHUTDOWN ) { +if (__mptcp_move_skbs (sk)) +continue ; +break ; + } + ret = err;break ; -if (shutdown ==0 ) -continue ; + }/* if __mptcp_splice_read() got nothing while we have * an skb in receive queue, we do not want to loop. * This might happen with URG data.
@@ -4106,9 +4110,7 @@ static ssize_t mptcp_splice_read(struct socket *sock, loff_t *ppos,release_sock (sk);lock_sock (sk); -if (sk->sk_err || sk->sk_state ==TCP_CLOSE || - (sk->sk_shutdown &RCV_SHUTDOWN ) || -signal_pending (current)) +if (mptcp_recv_should_stop (sk, timeo))break ; }
Signature · 1 line
2.48.1
Hi Geliang,
Thank you for your modifications, that's great!
But sadly, our CI spotted some issues with it when trying to build it.
You can find more details there:
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/16190147090
Status: failure
Initiator: Matthieu Baerts (NGI0)
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/b9f1f8861133
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=980902
Feel free to reply to this email if you cannot access logs, if you need some support to fix the error, if this doesn't seem to be caused by your modifications or if the error is a false positive one.
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
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): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/16190147099
Initiator: Matthieu Baerts (NGI0)
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/b9f1f8861133
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=980902
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)