From: Gang Yan <gang.yan@linux.dev>
To: mptcp@lists.linux.dev
Cc: pabeni@redhat.com, Gang Yan <yangang@kylinos.cn>
Subject: [RESEND PATCH mptcp-net] mptcp: sync the msk->sndbuf at accept() time
Date: Fri, 6 Mar 2026 14:23:16 +0800 [thread overview]
Message-ID: <20260306062316.1333680-1-gang.yan@linux.dev> (raw)
From: Gang Yan <yangang@kylinos.cn>
After an MPTCP connection is established, the sk_sndbuf of client's msk
can be updated through 'subflow_finish_connect'. However, the newly
accepted msk on the server side has a small sk_sndbuf than
msk->first->sk_sndbuf:
'''
MPTCP: msk:00000000e55b09db, msk->sndbuf:20480, msk->first->sndbuf:2626560
'''
This means that when the server immediately sends MSG_DONTWAIT data to
the client after the connection is established, it is more likely to
encounter EAGAIN.
This patch synchronizes the sk_sndbuf by triggering its update during accept.
Fixes: 8005184fd1ca ("mptcp: refactor sndbuf auto-tuning")
Link: https://github.com/multipath-tcp/mptcp_net-next/issues/602
Signed-off-by: Gang Yan <yangang@kylinos.cn>
---
Notes:
Hi Paolo, Matt,
Sorry for the late response for this patch. I've been analyzing this
issue recently, and the basic picture is as follows:
The root cause is a timing gap between msk creation and TCP sndbuf
auto-tuning on the server side:
1. When the server receives the SYN, mptcp_sk_clone_init() creates the
msk and calls __mptcp_propagate_sndbuf(). At this point, the TCP
subflow is still in SYN_RCVD state, so its sk_sndbuf has only the
initial value (tcp_wmem[1], typically ~16KB).
2. When the 3-way handshake completes (ACK received), the TCP stack
calls tcp_init_buffer_space() -> tcp_sndbuf_expand(), which grows
the subflow's sk_sndbuf based on MSS, congestion window, etc.
(potentially up to tcp_wmem[2], ~4MB).
3. However, this auto-tuning happens deep in the TCP stack without
any callback to MPTCP, so msk->sk_sndbuf is never updated to
reflect the new subflow sndbuf value.
4. When accept() returns, msk->sk_sndbuf still holds the small initial
value, while msk->first->sk_sndbuf has been auto-tuned to a much
larger value.
In contrast, the active (client) side doesn't have this issue because
subflow_finish_connect() calls mptcp_propagate_state() after the TCP
sndbuf auto-tuning has already occurred, ensuring proper synchronization.
Thanks
Gang
net/mptcp/protocol.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index b5676b37f8f4..17e43aff4459 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -4232,6 +4232,7 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,
mptcp_graft_subflows(newsk);
mptcp_rps_record_subflows(msk);
+ __mptcp_propagate_sndbuf(newsk, mptcp_subflow_tcp_sock(subflow));
/* Do late cleanup for the first subflow as necessary. Also
* deal with bad peers not doing a complete shutdown.
--
2.43.0
next reply other threads:[~2026-03-06 6:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 6:23 Gang Yan [this message]
2026-03-06 8:00 ` [RESEND PATCH mptcp-net] mptcp: sync the msk->sndbuf at accept() time MPTCP CI
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260306062316.1333680-1-gang.yan@linux.dev \
--to=gang.yan@linux.dev \
--cc=mptcp@lists.linux.dev \
--cc=pabeni@redhat.com \
--cc=yangang@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox