All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport mainline fixes
@ 2026-11-16 14:43 Eva Kurchatova
  2026-11-16 14:43 ` [Devel] [PATCH hci-8.1 1/2] ms/mptcp: do not reschedule the RTX timer for fallback sockets Eva Kurchatova
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Eva Kurchatova @ 2026-11-16 14:43 UTC (permalink / raw)
  To: khorenko; +Cc: devel

Patchset for tasks:
- https://virtuozzo.atlassian.net/browse/VSTOR-154928
- https://virtuozzo.atlassian.net/browse/VSTOR-154927

Rebased backports from mainline only.

Paolo Abeni (2):
  ms/mptcp: do not reschedule the RTX timer for fallback sockets
  ms/mptcp: fix subflow bitfield misuse

 net/mptcp/protocol.c | 12 +++++++++---
 net/mptcp/protocol.h |  8 ++++++--
 2 files changed, 15 insertions(+), 5 deletions(-)

-- 
2.56.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Devel] [PATCH hci-8.1 1/2] ms/mptcp: do not reschedule the RTX timer for fallback sockets
  2026-11-16 14:43 [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport mainline fixes Eva Kurchatova
@ 2026-11-16 14:43 ` Eva Kurchatova
  2026-11-16 15:02   ` no-reply
  2026-11-16 14:43 ` [Devel] [PATCH hci-8.1 2/2] ms/mptcp: fix subflow bitfield misuse Eva Kurchatova
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Eva Kurchatova @ 2026-11-16 14:43 UTC (permalink / raw)
  To: khorenko; +Cc: devel

From: Paolo Abeni <pabeni@redhat.com>

On fallback socket the retrans timer is a quite convoluted no-op, but
currently nothing prevents the MPTCP core to keep rescheduling it.

Additionally gate RTX timer reset to the msk not being fallen back to
TCP yet. To avoid adding multiple tests in fast-path, use a new flags
bit for such condition.

The RTX enable bit is clear at close time and set before the msk could
start retransmitting, with a couple of caveats:

- passive sockets inherit the bit from the listener msk; set the bit on
  such socket to avoid flipping it in the fast-path, even if the
  listener will obviously never retransmit.

- while fastopening (MPTFO), mptcp_sendmsg_fastopen still ends-up
  calling mptcp_connect via tcp_sendmsg_fastopen ->
  __inet_stream_connect(ssk->sk_socket), and the first subflow's
  sk_socket points to the msk one.

Fixes: b51f9b80c032 ("mptcp: introduce MPTCP retransmission timer")
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260908-net-mptcp-misc-fixes-7-3-rc1-v2-1-df1de70348b6@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit e2ab913f68c7d11e2561b8a8ad0b87ffefcad667)

Rebase note: this tree lacks commit c65c2e3bae69 ("mptcp: track
fallbacks accurately via mibs"), so __mptcp_try_fallback() is still
the inline in protocol.h and clears the bit there. It also lacks
commit 9a5e5334adc0 ("tcp: remove icsk->icsk_retransmit_timer"), so
mptcp_reset_rtx_timer() keeps rearming icsk_retransmit_timer.

https://virtuozzo.atlassian.net/browse/VSTOR-154928
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 net/mptcp/protocol.c | 12 +++++++++---
 net/mptcp/protocol.h |  2 ++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index e526648a583e..384ad1a8b5c0 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -860,13 +860,14 @@ static bool mptcp_rtx_timer_pending(struct sock *sk)
 static void mptcp_reset_rtx_timer(struct sock *sk)
 {
 	struct inet_connection_sock *icsk = inet_csk(sk);
+	struct mptcp_sock *msk = mptcp_sk(sk);
 	unsigned long tout;
 
-	/* prevent rescheduling on close */
-	if (unlikely(inet_sk_state_load(sk) == TCP_CLOSE))
+	/* Prevent rescheduling on close and in case of fallback. */
+	if (!test_bit(MPTCP_RTX_ENABLED, &msk->flags))
 		return;
 
-	tout = mptcp_sk(sk)->timer_ival;
+	tout = msk->timer_ival;
 	sk_reset_timer(sk, &icsk->icsk_retransmit_timer, jiffies + tout);
 }
 
@@ -2951,6 +2952,9 @@ void mptcp_set_state(struct sock *sk, int state)
 		 * transition from TCP_SYN_RECV to TCP_CLOSE_WAIT.
 		 */
 		break;
+	case TCP_CLOSE:
+		clear_bit(MPTCP_RTX_ENABLED, &mptcp_sk(sk)->flags);
+		fallthrough;
 	default:
 		if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT)
 			MPTCP_DEC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB);
@@ -3747,6 +3751,7 @@ static int mptcp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 	if (IS_ERR(ssk))
 		return PTR_ERR(ssk);
 
+	set_bit(MPTCP_RTX_ENABLED, &msk->flags);
 	mptcp_set_state(sk, TCP_SYN_SENT);
 	subflow = mptcp_subflow_ctx(ssk);
 #ifdef CONFIG_TCP_MD5SIG
@@ -3895,6 +3900,7 @@ static int mptcp_listen(struct socket *sock, int backlog)
 		goto unlock;
 	}
 
+	set_bit(MPTCP_RTX_ENABLED, &msk->flags);
 	mptcp_set_state(sk, TCP_LISTEN);
 	sock_set_flag(sk, SOCK_RCU_FREE);
 
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 22804ae2e85a..baec108dd7e5 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -115,6 +115,7 @@
 #define MPTCP_WORK_RTX		1
 #define MPTCP_FALLBACK_DONE	2
 #define MPTCP_WORK_CLOSE_SUBFLOW 3
+#define MPTCP_RTX_ENABLED	4
 
 /* MPTCP socket release cb flags */
 #define MPTCP_PUSH_PENDING	1
@@ -1231,6 +1232,7 @@ static inline bool __mptcp_try_fallback(struct mptcp_sock *msk)
 
 	msk->allow_subflows = false;
 	set_bit(MPTCP_FALLBACK_DONE, &msk->flags);
+	clear_bit(MPTCP_RTX_ENABLED, &msk->flags);
 	spin_unlock_bh(&msk->fallback_lock);
 	return true;
 }
-- 
2.56.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Devel] [PATCH hci-8.1 2/2] ms/mptcp: fix subflow bitfield misuse
  2026-11-16 14:43 [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport mainline fixes Eva Kurchatova
  2026-11-16 14:43 ` [Devel] [PATCH hci-8.1 1/2] ms/mptcp: do not reschedule the RTX timer for fallback sockets Eva Kurchatova
@ 2026-11-16 14:43 ` Eva Kurchatova
  2026-11-16 15:00   ` no-reply
  2026-11-16 17:03 ` [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport mainline fixes Konstantin Khorenko
  2026-11-16 17:04 ` Konstantin Khorenko
  3 siblings, 1 reply; 7+ messages in thread
From: Eva Kurchatova @ 2026-11-16 14:43 UTC (permalink / raw)
  To: khorenko; +Cc: devel

From: Paolo Abeni <pabeni@redhat.com>

The subflow status bitfield is protected by the subflow socket lock,
with one notable exception: the `close_event_done` bit is actually under
the msk socket lock protection.

As reported by Clashiko [1], flipping the latter bit may corrupt other
entries in the same bitfield.

Move the `close_event_done` outside the bitfield, in a 32bit hole.

Link: https://lore.kernel.org/178959153492.22033.1944011998010756543@kernel.org
Fixes: d82809b6c5f2 ("mptcp: avoid duplicated SUB_CLOSED events")
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20261013-net-mptcp-misc-fixes-7-3-rc8-v1-2-932c9b182fc7@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 7538fa33bb2f66b8b809ff39d58308be48e197a0)

Rebase note: this tree has neither the "closing" nor the "resetting"
subflow flag, nor lent_mem_frag, so __unused grows from 9 to 10 and
close_event_done goes after fully_established.

https://virtuozzo.atlassian.net/browse/VSTOR-154927
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 net/mptcp/protocol.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index baec108dd7e5..b083ca562c79 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -534,13 +534,15 @@ struct mptcp_subflow_context {
 		stale : 1,	    /* unable to snd/rcv data, do not use for xmit */
 		valid_csum_seen : 1,        /* at least one csum validated */
 		is_mptfo : 1,	    /* subflow is doing TFO */
-		close_event_done : 1,       /* has done the post-closed part */
 		mpc_drop : 1,	    /* the MPC option has been dropped in a rtx */
-		__unused : 9;
+		__unused : 10;
 	bool	data_avail;
 	bool	scheduled;
 	bool	pm_listener;	    /* a listener managed by the kernel PM? */
 	bool	fully_established;  /* path validated */
+	bool	close_event_done;   /* has done the post-closed part,
+				     * protected by msk socket lock
+				     */
 	u32	remote_nonce;
 	u64	thmac;
 	u32	local_nonce;
-- 
2.56.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Devel] [PATCH hci-8.1 2/2] ms/mptcp: fix subflow bitfield misuse
  2026-11-16 14:43 ` [Devel] [PATCH hci-8.1 2/2] ms/mptcp: fix subflow bitfield misuse Eva Kurchatova
@ 2026-11-16 15:00   ` no-reply
  0 siblings, 0 replies; 7+ messages in thread
From: no-reply @ 2026-11-16 15:00 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko; +Cc: devel

> From: Paolo Abeni <pabeni@redhat.com>
> 
> The subflow status bitfield is protected by the subflow socket lock,
> with one notable exception: the `close_event_done` bit is actually under
> the msk socket lock protection.
> 
> As reported by Clashiko [1], flipping the latter bit may corrupt other
> entries in the same bitfield.
> 
> Move the `close_event_done` outside the bitfield, in a 32bit hole.
> 
> Link: https://lore.kernel.org/178959153492.22033.1944011998010756543@kernel.org
> Fixes: d82809b6c5f2 ("mptcp: avoid duplicated SUB_CLOSED events")
> Cc: stable@vger.kernel.org
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> Link: https://patch.msgid.link/20261013-net-mptcp-misc-fixes-7-3-rc8-v1-2-932c9b182fc7@kernel.org
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> (cherry picked from commit 7538fa33bb2f66b8b809ff39d58308be48e197a0)
> 
> Rebase note: this tree has neither the "closing" nor the "resetting"
> subflow flag, nor lent_mem_frag, so __unused grows from 9 to 10 and
> close_event_done goes after fully_established.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-154927
> Feature: fix ms/net
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116145652.625598-1-eva.kurchatova@virtuozzo.com?part=2


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Devel] [PATCH hci-8.1 1/2] ms/mptcp: do not reschedule the RTX timer for fallback sockets
  2026-11-16 14:43 ` [Devel] [PATCH hci-8.1 1/2] ms/mptcp: do not reschedule the RTX timer for fallback sockets Eva Kurchatova
@ 2026-11-16 15:02   ` no-reply
  0 siblings, 0 replies; 7+ messages in thread
From: no-reply @ 2026-11-16 15:02 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko; +Cc: devel

> From: Paolo Abeni <pabeni@redhat.com>
> 
> On fallback socket the retrans timer is a quite convoluted no-op, but
> currently nothing prevents the MPTCP core to keep rescheduling it.
> 
> Additionally gate RTX timer reset to the msk not being fallen back to
> TCP yet. To avoid adding multiple tests in fast-path, use a new flags
> bit for such condition.
> 
> The RTX enable bit is clear at close time and set before the msk could
> start retransmitting, with a couple of caveats:
> 
> - passive sockets inherit the bit from the listener msk; set the bit on
>   such socket to avoid flipping it in the fast-path, even if the
>   listener will obviously never retransmit.
> [ ... ]
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-154928
> Feature: fix ms/net
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116145652.625598-1-eva.kurchatova@virtuozzo.com?part=1


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport mainline fixes
  2026-11-16 14:43 [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport mainline fixes Eva Kurchatova
  2026-11-16 14:43 ` [Devel] [PATCH hci-8.1 1/2] ms/mptcp: do not reschedule the RTX timer for fallback sockets Eva Kurchatova
  2026-11-16 14:43 ` [Devel] [PATCH hci-8.1 2/2] ms/mptcp: fix subflow bitfield misuse Eva Kurchatova
@ 2026-11-16 17:03 ` Konstantin Khorenko
  2026-11-16 17:04 ` Konstantin Khorenko
  3 siblings, 0 replies; 7+ messages in thread
From: Konstantin Khorenko @ 2026-11-16 17:03 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

Applying as is.

On Mon, 16 Nov 2026 16:43:01 +0200, Eva Kurchatova <eva.kurchatova@virtuozzo.com> wrote:
> Paolo Abeni (2):
>   ms/mptcp: do not reschedule the RTX timer for fallback sockets
>   ms/mptcp: fix subflow bitfield misuse

Separate patches, not needed for this series. I created a task:

1. Two mainline fixes that go with these are missing here:
   29afe67082b2 ("mptcp: reset msk state on early connect failure"),
   patch 1 of the series 2/2 comes from: after an early fallback and
   a failed subflow connect the next connect() or listen() sets
   MPTCP_RTX_ENABLED again and nothing clears it. And 280d654324e3
   ("mptcp: avoid dup SUB_CLOSED events after disconnect"), another
   fix of d82809b6c5f2. 85c580b0d859 is already in VSTOR-155322.
   https://virtuozzo.atlassian.net/browse/VSTOR-155419

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport mainline fixes
  2026-11-16 14:43 [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport mainline fixes Eva Kurchatova
                   ` (2 preceding siblings ...)
  2026-11-16 17:03 ` [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport mainline fixes Konstantin Khorenko
@ 2026-11-16 17:04 ` Konstantin Khorenko
  3 siblings, 0 replies; 7+ messages in thread
From: Konstantin Khorenko @ 2026-11-16 17:04 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

On Mon, 16 Nov 2026 16:43:01 +0200, Eva Kurchatova wrote:
> ms/mptcp: backport mainline fixes
> 
> Patchset for tasks:
> - https://virtuozzo.atlassian.net/browse/VSTOR-154928
> - https://virtuozzo.atlassian.net/browse/VSTOR-154927
> 
> Rebased backports from mainline only.
> 
> [...]

Applied to branch-rh10-6.12.0-211.75.1.26.x.vz10-ovz, will be released in rh10-6.12.0-211.75.1.24.3.vz10, thanks!

[1/2] ms/mptcp: do not reschedule the RTX timer for fallback sockets
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/802295e28d21
[2/2] ms/mptcp: fix subflow bitfield misuse
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/d79fde42c8ab

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-16 17:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 14:43 [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport mainline fixes Eva Kurchatova
2026-11-16 14:43 ` [Devel] [PATCH hci-8.1 1/2] ms/mptcp: do not reschedule the RTX timer for fallback sockets Eva Kurchatova
2026-11-16 15:02   ` no-reply
2026-11-16 14:43 ` [Devel] [PATCH hci-8.1 2/2] ms/mptcp: fix subflow bitfield misuse Eva Kurchatova
2026-11-16 15:00   ` no-reply
2026-11-16 17:03 ` [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport mainline fixes Konstantin Khorenko
2026-11-16 17:04 ` Konstantin Khorenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.