From: Matthieu Baerts <matttbe@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-net v2 3/5] mptcp: fix status reset on disconnect()
Date: Wed, 9 Jul 2025 12:39:10 +0200 [thread overview]
Message-ID: <b5ec832f-2fe8-4dec-af09-db0affc3e5a6@kernel.org> (raw)
In-Reply-To: <31fe0442-ab45-438c-abe6-25a9d4f08927@redhat.com>
Hi Paolo,
Thank you for your reply!
On 09/07/2025 11:27, Paolo Abeni wrote:
>
>
> On 7/8/25 5:43 PM, Matthieu Baerts wrote:
>> Hi Paolo,
>>
>> On 05/07/2025 09:24, Paolo Abeni wrote:
>>> disconnect() can still race with subflow fallback leaving the msk in
>>> inconsistent status. To avoid such race, disconnect() must be blocking,
>>> error out if the argument prevent such wait: the socket will linger
>>> in SS_DISCONNECT state forever.
>>
>> Good idea!
>>
>> Just to be sure, this is not really a behaviour change compared to TCP,
>> right?
>
> Actually it is, as the TCP disconnect never blocks. On the flip side the
> race actually exists and I haven't find another way to plug it.
>
> An alternative I thought about was to create a new first subflow on
> disconnect and let the old one 'detach' from the mptcp socket, but that
> was problematic as the 'detached' ssk would have a NULL subflow->conn
> and currently we assume that to be ~always != NULL
Indeed, it doesn't sound safer :)
>> No risks of breaking some cases? (io_uring, etc.?)
>
> Do io_uring work with mptcp?
I don't know, I never tried. But I don't see why it wouldn't. (Of
course, not when used with zero copy, etc.)
> The disconnect failure when blocking is not
> possible should really never be a problem from a functional PoV:
> disconnect() can fail per documentation and the application should
> handle that case.
But it could set "O_NONBLOCK" and do the close later, no? Or is this
correctly handled?
> Blocking could cause some additional latency or slowdown in that code
> path. I think it should be not problematic, but I have no real idea and
> tend to be too optimistic WRT this kind of issues.
>
> I suggest not sending this to stable (with a note in the commit message).
Maybe safer indeed.
>> In which cases is this MSG_DONTWAIT flag set with disconnect()?
>
> Typo in the patch, should be O_NONBLOCK. The socket layer, the vfs layer
> and iouring could set that.
So typically what we do in the packetdrill tests. But maybe we don't
check the returned value?
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2025-07-09 10:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-05 7:24 [PATCH mptcp-net v2 0/5] mptcp: fix fallback-related races Paolo Abeni
2025-07-05 7:24 ` [PATCH mptcp-net v2 1/5] mptcp: make fallback action and fallback decision atomic Paolo Abeni
2025-07-08 14:54 ` Matthieu Baerts
2025-07-08 15:13 ` Matthieu Baerts
2025-07-09 9:09 ` Paolo Abeni
2025-07-05 7:24 ` [PATCH mptcp-net v2 2/5] mptcp: plug races between subflow fail and subflow creation Paolo Abeni
2025-07-08 15:42 ` Matthieu Baerts
2025-07-09 9:14 ` Paolo Abeni
2025-07-09 9:18 ` Matthieu Baerts
2025-07-05 7:24 ` [PATCH mptcp-net v2 3/5] mptcp: fix status reset on disconnect() Paolo Abeni
2025-07-08 15:43 ` Matthieu Baerts
2025-07-09 9:27 ` Paolo Abeni
2025-07-09 10:39 ` Matthieu Baerts [this message]
2025-07-09 10:49 ` Paolo Abeni
2025-07-09 10:55 ` Matthieu Baerts
2025-07-09 12:33 ` Paolo Abeni
2025-07-05 7:24 ` [PATCH mptcp-net v2 4/5] mptcp: track fallbacks accurately via mibs Paolo Abeni
2025-07-08 15:56 ` Matthieu Baerts
2025-07-09 9:55 ` Paolo Abeni
2025-07-09 10:23 ` Paolo Abeni
2025-07-09 10:42 ` Matthieu Baerts
2025-07-09 10:55 ` Matthieu Baerts
2025-07-05 7:24 ` [PATCH mptcp-net v2 5/5] mptcp: remove pr_fallback() Paolo Abeni
2025-07-05 18:04 ` kernel test robot
2025-07-08 15:57 ` Matthieu Baerts
2025-07-07 7:43 ` [PATCH mptcp-net v2 0/5] mptcp: fix fallback-related races MPTCP CI
2025-07-07 8:47 ` MPTCP CI
2025-07-08 15:41 ` Matthieu Baerts
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=b5ec832f-2fe8-4dec-af09-db0affc3e5a6@kernel.org \
--to=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=pabeni@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).