[PATCH mptcp-next v2 05/12] mptcp: remove unneeded mptcp_move_skb()

Paolo Abeni posted 12 patches 3 weeks, 1 day ago
There is a newer version of this series
[PATCH mptcp-next v2 05/12] mptcp: remove unneeded mptcp_move_skb()
Posted by Paolo Abeni 3 weeks, 1 day ago
Since commit b7535cfed223 ("mptcp: drop legacy code around RX EOF"),
sk_shutdown can't change during the main recvmsg loop, we can drop
the related race breaker.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/mptcp/protocol.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 048056b29a92d..19b5b925e2acc 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2202,14 +2202,8 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
 				break;
 			}
 
-			if (sk->sk_shutdown & RCV_SHUTDOWN) {
-				/* race breaker: the shutdown could be after the
-				 * previous receive queue check
-				 */
-				if (__mptcp_move_skbs(sk))
-					continue;
+			if (sk->sk_shutdown & RCV_SHUTDOWN)
 				break;
-			}
 
 			if (sk->sk_state == TCP_CLOSE) {
 				copied = -ENOTCONN;
-- 
2.51.0
Re: [PATCH mptcp-next v2 05/12] mptcp: remove unneeded mptcp_move_skb()
Posted by Matthieu Baerts 3 weeks ago
Hi Paolo,

On 18/09/2025 19:14, Paolo Abeni wrote:
> Since commit b7535cfed223 ("mptcp: drop legacy code around RX EOF"),
> sk_shutdown can't change during the main recvmsg loop, we can drop
> the related race breaker.

Good catch, thanks!

Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-next v2 05/12] mptcp: remove unneeded mptcp_move_skb()
Posted by Geliang Tang 3 weeks ago
On Thu, 2025-09-18 at 19:14 +0200, Paolo Abeni wrote:
> Since commit b7535cfed223 ("mptcp: drop legacy code around RX EOF"),
> sk_shutdown can't change during the main recvmsg loop, we can drop
> the related race breaker.
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

LGTM!

Reviewed-by: Geliang Tang <geliang@kernel.org>
Tested-by: Geliang Tang <geliang@kernel.org>

Thanks,
-Geliang

> ---
>  net/mptcp/protocol.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 048056b29a92d..19b5b925e2acc 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -2202,14 +2202,8 @@ static int mptcp_recvmsg(struct sock *sk,
> struct msghdr *msg, size_t len,
>  				break;
>  			}
>  
> -			if (sk->sk_shutdown & RCV_SHUTDOWN) {
> -				/* race breaker: the shutdown could
> be after the
> -				 * previous receive queue check
> -				 */
> -				if (__mptcp_move_skbs(sk))
> -					continue;
> +			if (sk->sk_shutdown & RCV_SHUTDOWN)
>  				break;
> -			}
>  
>  			if (sk->sk_state == TCP_CLOSE) {
>  				copied = -ENOTCONN;