FAILED: patch "[PATCH] mptcp: propagate shutdown to subflows when possible" failed to apply to 5.10-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x f755be0b1ff429a2ecf709beeb1bcd7abc111c2b
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025092143-trench-expiring-9a2f@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f755be0b1ff429a2ecf709beeb1bcd7abc111c2b Mon Sep 17 00:00:00 2001
From: "Matthieu Baerts (NGI0)" <[email protected]>
Date: Fri, 12 Sep 2025 14:25:50 +0200
Subject: [PATCH] mptcp: propagate shutdown to subflows when possible
When the MPTCP DATA FIN have been ACKed, there is no more MPTCP related metadata to exchange, and all subflows can be safely shutdown.
Before this patch, the subflows were actually terminated at 'close()' time. That's certainly fine most of the time, but not when the userspace 'shutdown()' a connection, without close()ing it. When doing so, the subflows were staying in LAST_ACK state on one side -- and consequently in FIN_WAIT2 on the other side -- until the 'close()' of the MPTCP socket.
Now, when the DATA FIN have been ACKed, all subflows are shutdown. A consequence of this is that the TCP 'FIN' flag can be set earlier now, but the end result is the same. This affects the packetdrill tests looking at the end of the MPTCP connections, but for a good reason.
Note that tcp_shutdown() will check the subflow state, so no need to do that again before calling it.
net/mptcp/protocol.c +16 -0
@@ -371,6 +371,20 @@ static void mptcp_close_wake_up(struct sock *sk)sk_wake_async (sk,SOCK_WAKE_WAITD ,POLL_IN ); } +static void mptcp_shutdown_subflows (struct mptcp_sock *msk) +{ +struct mptcp_subflow_context *subflow; + +mptcp_for_each_subflow (msk, subflow) { +struct sock *ssk =mptcp_subflow_tcp_sock (subflow); +bool slow; + + slow =lock_sock_fast (ssk); +tcp_shutdown (ssk,SEND_SHUTDOWN ); +unlock_sock_fast (ssk, slow); + } +} +/* called under the msk socket lock */ static bool mptcp_pending_data_fin_ack (struct sock *sk) {
@@ -395,6 +409,7 @@ static void mptcp_check_data_fin_ack(struct sock *sk)break ;case TCP_CLOSING :case TCP_LAST_ACK : +mptcp_shutdown_subflows (msk);mptcp_set_state (sk,TCP_CLOSE );break ; }
@@ -563,6 +578,7 @@ static bool mptcp_check_data_fin(struct sock *sk)mptcp_set_state (sk,TCP_CLOSING );break ;case TCP_FIN_WAIT2 : +mptcp_shutdown_subflows (msk);mptcp_set_state (sk,TCP_CLOSE );break ;default :
Sasha Levin
maintainerPATCH 1/1 mptcp: propagate shutdown to subflows when possible
From: "Matthieu Baerts (NGI0)" <[email protected]>
[ Upstream commit f755be0b1ff429a2ecf709beeb1bcd7abc111c2b ]
When the MPTCP DATA FIN have been ACKed, there is no more MPTCP related metadata to exchange, and all subflows can be safely shutdown.
Before this patch, the subflows were actually terminated at 'close()' time. That's certainly fine most of the time, but not when the userspace 'shutdown()' a connection, without close()ing it. When doing so, the subflows were staying in LAST_ACK state on one side -- and consequently in FIN_WAIT2 on the other side -- until the 'close()' of the MPTCP socket.
Now, when the DATA FIN have been ACKed, all subflows are shutdown. A consequence of this is that the TCP 'FIN' flag can be set earlier now, but the end result is the same. This affects the packetdrill tests looking at the end of the MPTCP connections, but for a good reason.
Note that tcp_shutdown() will check the subflow state, so no need to do that again before calling it.
--- net/mptcp/protocol.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
net/mptcp/protocol.c +16 -0
@@ -326,6 +326,20 @@ static void mptcp_stop_timer(struct sock *sk)mptcp_sk (sk)->timer_ival =0 ; } +static void mptcp_shutdown_subflows (struct mptcp_sock *msk) +{ +struct mptcp_subflow_context *subflow; + +mptcp_for_each_subflow (msk, subflow) { +struct sock *ssk =mptcp_subflow_tcp_sock (subflow); +bool slow; + + slow =lock_sock_fast (ssk); +tcp_shutdown (ssk,SEND_SHUTDOWN ); +unlock_sock_fast (ssk, slow); + } +} +static void mptcp_check_data_fin_ack (struct sock *sk) {struct mptcp_sock *msk =mptcp_sk (sk);
@@ -348,6 +362,7 @@ static void mptcp_check_data_fin_ack(struct sock *sk)break ;case TCP_CLOSING :case TCP_LAST_ACK : +mptcp_shutdown_subflows (msk);inet_sk_state_store (sk,TCP_CLOSE ); sk->sk_state_change (sk);break ;
@@ -430,6 +445,7 @@ static void mptcp_check_data_fin(struct sock *sk)inet_sk_state_store (sk,TCP_CLOSING );break ;case TCP_FIN_WAIT2 : +mptcp_shutdown_subflows (msk);inet_sk_state_store (sk,TCP_CLOSE );// @@ Close subflows now? break ;
Signature · 1 line
2.51.0