[PATCH mptcp-next v2 07/12] mptcp: minor move_skbs_to_msk() cleanup

Paolo Abeni posted 12 patches 3 weeks, 1 day ago
There is a newer version of this series
[PATCH mptcp-next v2 07/12] mptcp: minor move_skbs_to_msk() cleanup
Posted by Paolo Abeni 3 weeks, 1 day ago
Such function is called only by __mptcp_data_ready(), which in turn
is always invoked when msk is not owned by the user: we can drop the
redundant, related check.

Additionally mptcp needs to propagate the socket error only for
current subflow.

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

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 66ad9a38a6082..02be42d3d11e6 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -810,12 +810,8 @@ static bool move_skbs_to_msk(struct mptcp_sock *msk, struct sock *ssk)
 
 	moved = __mptcp_move_skbs_from_subflow(msk, ssk);
 	__mptcp_ofo_queue(msk);
-	if (unlikely(ssk->sk_err)) {
-		if (!sock_owned_by_user(sk))
-			__mptcp_error_report(sk);
-		else
-			__set_bit(MPTCP_ERROR_REPORT,  &msk->cb_flags);
-	}
+	if (unlikely(ssk->sk_err))
+		__mptcp_subflow_error_report(sk, ssk);
 
 	/* If the moves have caught up with the DATA_FIN sequence number
 	 * it's time to ack the DATA_FIN and change socket state, but
-- 
2.51.0
Re: [PATCH mptcp-next v2 07/12] mptcp: minor move_skbs_to_msk() cleanup
Posted by Matthieu Baerts 3 weeks ago
Hi Paolo,

On 18/09/2025 19:14, Paolo Abeni wrote:
> Such function is called only by __mptcp_data_ready(), which in turn
> is always invoked when msk is not owned by the user: we can drop the
> redundant, related check.
> 
> Additionally mptcp needs to propagate the socket error only for
> current subflow.

Ah yes, good point! Should this be considered as a dedicated fix or is
the impact not important?

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

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-next v2 07/12] mptcp: minor move_skbs_to_msk() cleanup
Posted by Paolo Abeni 3 weeks ago
On 9/19/25 2:36 PM, Matthieu Baerts wrote:
> On 18/09/2025 19:14, Paolo Abeni wrote:
>> Such function is called only by __mptcp_data_ready(), which in turn
>> is always invoked when msk is not owned by the user: we can drop the
>> redundant, related check.
>>
>> Additionally mptcp needs to propagate the socket error only for
>> current subflow.
> 
> Ah yes, good point! Should this be considered as a dedicated fix or is
> the impact not important?

I think it is more an optimization/cleanup than a fix.

/P
Re: [PATCH mptcp-next v2 07/12] mptcp: minor move_skbs_to_msk() cleanup
Posted by Geliang Tang 3 weeks ago
On Thu, 2025-09-18 at 19:14 +0200, Paolo Abeni wrote:
> Such function is called only by __mptcp_data_ready(), which in turn
> is always invoked when msk is not owned by the user: we can drop the
> redundant, related check.
> 
> Additionally mptcp needs to propagate the socket error only for
> current subflow.
> 
> 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, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 66ad9a38a6082..02be42d3d11e6 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -810,12 +810,8 @@ static bool move_skbs_to_msk(struct mptcp_sock
> *msk, struct sock *ssk)
>  
>  	moved = __mptcp_move_skbs_from_subflow(msk, ssk);
>  	__mptcp_ofo_queue(msk);
> -	if (unlikely(ssk->sk_err)) {
> -		if (!sock_owned_by_user(sk))
> -			__mptcp_error_report(sk);
> -		else
> -			__set_bit(MPTCP_ERROR_REPORT,  &msk-
> >cb_flags);
> -	}
> +	if (unlikely(ssk->sk_err))
> +		__mptcp_subflow_error_report(sk, ssk);
>  
>  	/* If the moves have caught up with the DATA_FIN sequence
> number
>  	 * it's time to ack the DATA_FIN and change socket state,
> but