From: Geliang Tang <geliang@kernel.org>
To: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>,
MPTCP Upstream <mptcp@lists.linux.dev>
Subject: Re: [PATCH mptcp-next 03/11] mptcp: only reset subflow errors when propagated
Date: Sun, 04 Jan 2026 12:00:19 +0800 [thread overview]
Message-ID: <4804f03c203e4f06d20bf3c6af5f45146d0709dc.camel@kernel.org> (raw)
In-Reply-To: <f142ce4aab700eff3bbbdebd6ee9d3b1fb370f7a.camel@kernel.org>
On Sun, 2026-01-04 at 11:30 +0800, Geliang Tang wrote:
> Hi Matt,
>
> On Fri, 2025-12-26 at 07:40 +0100, Matthieu Baerts (NGI0) wrote:
> > Some subflow socket errors need to be reported to the MPTCP socket:
> > the
> > initial subflow connect (MP_CAPABLE), and the ones from the
> > fallback
> > sockets. The others are not propagated.
> >
> > The issue is that sock_error() was used to retrieve the error,
> > which
> > was
> > also resetting the sk_err field. Because of that, when notifying
> > the
> > userspace about subflow close events later on from the MPTCP
> > worker,
> > the
> > ssk->sk_err field was always 0.
> >
> > Now, the error (sk_err) is only reset when propagating it to the
> > msk.
> >
> > Fixes: 15cc10453398 ("mptcp: deliver ssk errors to msk")
> > Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> > ---
> > Note: I guess we could also duplicate the error in
> > mptcp_subflow_context
> > struct before scheduling the worker, and use this field in
> > mptcp_event_put_token_and_ssk(), but I don't see why we should
> > always
> > reset ssk->sk_err in __mptcp_subflow_error_report() in all cases.
> > ---
> > net/mptcp/protocol.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> > index 1d68648b5194..5d6c987089c6 100644
> > --- a/net/mptcp/protocol.c
> > +++ b/net/mptcp/protocol.c
> > @@ -817,10 +817,9 @@ static bool __mptcp_ofo_queue(struct
> > mptcp_sock
> > *msk)
> >
> > static bool __mptcp_subflow_error_report(struct sock *sk, struct
> > sock *ssk)
> > {
> > - int err = sock_error(ssk);
> > int ssk_state;
> >
> > - if (!err)
> > + if (!READ_ONCE(ssk->sk_err))
> > return false;
>
> Your fix works. I'm wondering if swapping the order of 'if (sk-
> > sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(mptcp_sk(sk)))'
> and 'if (!err)' would be a bit simpler, i.e.:
>
> int err = sock_error(ssk);
> int ssk_state;
>
> if (sk->sk_state != TCP_SYN_SENT &&
> !__mptcp_check_fallback(mptcp_sk(sk)))
> return false;
>
> if (!err)
> return false;
Sorry, I was mistaken. It should be like this:
int ssk_state;
int err;
if (sk->sk_state != TCP_SYN_SENT &&
!__mptcp_check_fallback(mptcp_sk(sk)))
return false;
err = sock_error(ssk);
if (!err)
return false;
>
> WDYT?
>
> Thanks,
> -Geliang
>
> >
> > /* only propagate errors on fallen-back sockets or
> > @@ -837,7 +836,7 @@ static bool __mptcp_subflow_error_report(struct
> > sock *sk, struct sock *ssk)
> > ssk_state = inet_sk_state_load(ssk);
> > if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD))
> > mptcp_set_state(sk, ssk_state);
> > - WRITE_ONCE(sk->sk_err, -err);
> > + WRITE_ONCE(sk->sk_err, -sock_error(ssk));
> >
> > /* This barrier is coupled with smp_rmb() in mptcp_poll()
> > */
> > smp_wmb();
next prev parent reply other threads:[~2026-01-04 4:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-26 6:40 [PATCH mptcp-next 00/11] mptcp: avoid dup events + error + misc Matthieu Baerts (NGI0)
2025-12-26 6:40 ` [PATCH mptcp-next 01/11] mptcp: avoid dup SUB_CLOSED events after disconnect Matthieu Baerts (NGI0)
2026-01-04 3:15 ` Geliang Tang
2025-12-26 6:40 ` [PATCH mptcp-next 02/11] selftests: mptcp: check no dup close events after error Matthieu Baerts (NGI0)
2026-01-04 3:17 ` Geliang Tang
2025-12-26 6:40 ` [PATCH mptcp-next 03/11] mptcp: only reset subflow errors when propagated Matthieu Baerts (NGI0)
2026-01-04 3:30 ` Geliang Tang
2026-01-04 4:00 ` Geliang Tang [this message]
2025-12-26 6:40 ` [PATCH mptcp-next 04/11] selftests: mptcp: check subflow errors in close events Matthieu Baerts (NGI0)
2025-12-26 6:40 ` [PATCH mptcp-next 05/11] selftests: mptcp: join: wait for estab event instead of MPJ Matthieu Baerts (NGI0)
2025-12-28 2:41 ` Geliang Tang
2025-12-26 6:40 ` [PATCH mptcp-next 06/11] selftests: mptcp: join: fix wait_mpj helper Matthieu Baerts (NGI0)
2025-12-26 6:40 ` [PATCH mptcp-next 07/11] selftests: mptcp: join: userspace: wait for new events Matthieu Baerts (NGI0)
2025-12-28 2:48 ` Geliang Tang
2026-01-26 18:59 ` Matthieu Baerts
2025-12-26 6:40 ` [PATCH mptcp-next 08/11] selftests: mptcp: join chk_stale_nr: avoid dup stats Matthieu Baerts (NGI0)
2025-12-28 2:25 ` Geliang Tang
2025-12-28 4:43 ` Geliang Tang
2025-12-26 6:40 ` [PATCH mptcp-next 09/11] selftests: mptcp: join: avoid declaring i if not used Matthieu Baerts (NGI0)
2025-12-28 2:51 ` Geliang Tang
2025-12-26 6:40 ` [PATCH mptcp-next 10/11] selftests: mptcp: connect: fix maybe-uninitialize warn Matthieu Baerts (NGI0)
2025-12-28 2:54 ` Geliang Tang
2026-01-26 19:02 ` Matthieu Baerts
2025-12-26 6:40 ` [PATCH mptcp-next 11/11] selftests: mptcp: connect cleanup TFO setup Matthieu Baerts (NGI0)
2025-12-28 2:59 ` Geliang Tang
2025-12-26 7:51 ` [PATCH mptcp-next 00/11] mptcp: avoid dup events + error + misc 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=4804f03c203e4f06d20bf3c6af5f45146d0709dc.camel@kernel.org \
--to=geliang@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
/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