All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geliang Tang <geliang.tang@suse.com>
To: Matthieu Baerts <matttbe@kernel.org>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v11 1/4] mptcp: set next subflow to msk->first
Date: Tue, 10 Oct 2023 14:04:03 +0800	[thread overview]
Message-ID: <20231010060403.GA6593@localhost.localdomain> (raw)
In-Reply-To: <ff0b0fbc-8bb1-4579-b1b9-09cc06ab734e@kernel.org>

On Sun, Oct 08, 2023 at 04:05:10PM +0200, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 08/10/2023 14:33, Geliang Tang wrote:
> > On Sun, Oct 08, 2023 at 01:11:32PM +0200, Matthieu Baerts wrote:
> >> Hi Geliang,
> >>
> >> +cc Paolo
> >>
> >> On 08/10/2023 12:27, Geliang Tang wrote:
> >>> When closing the msk->first socket in __mptcp_close_ssk(), the original
> >>> behaviour is to reset this socket. But if there's another subflow available
> >>> in this case, it's better to set the first available subflow to msk->first,
> >>> instead of resetting the msk->first.
> >>
> >> I don't think we want to do that. If I remember well, we want to keep
> >> having 'msk->first' pointing to the initial subflow for various reasons
> >> (I don't remember exactly).
> >>
> >> I think what we want to do is not to reset the initial subflow if there
> >> are other subflows still available and we don't want to set it to 'NULL'
> >> in such case.
> > 
> > Is it like this:
> > 
> >        if (ssk == msk->first && !msk->pm.subflows)
> >                WRITE_ONCE(msk->first, NULL);

The code:

        if (ssk == msk->first && list_is_singular(&msk->conn_list))
                WRITE_ONCE(msk->first, NULL);

works, no NULL pointer crash with this now. I update it into v12.

> 
> No, we cannot set it to NULL nor release it but we should avoid the
> "reset" being sent.
> 
> I don't have access to the code for the moment but by looking at your
> patch, I would say you should not modify 'dispose_it' nor 'msk->first'
> but maybe check if you can avoid calling 'mptcp_subflow_ctx_reset()' if
> '!dispose_it', maybe by checking something like
> 'list_is_singular(&msk->conn_list)'? (I think you should avoid looking
> at the PM structure here).

Something like this, right:

                 * disconnect should never fail
                 */
                WARN_ON_ONCE(tcp_disconnect(ssk, 0));
-               mptcp_subflow_ctx_reset(subflow);
+               list_is_singular(&msk->conn_list)
+                       mptcp_subflow_ctx_reset(subflow);
                release_sock(ssk);
 
                goto out;

This doesn't work, if we only avoid calling mptcp_subflow_ctx_reset,
tcp_disconnect will send a RST too.

Thanks,
-Geliang

> 
> Please tell me if it is not clear.
> 
> Cheers,
> Matt
> -- 
> Tessares | Belgium | Hybrid Access Solutions
> www.tessares.net

  reply	other threads:[~2023-10-10  6:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-08 10:27 [PATCH mptcp-next v11 0/4] userspace pm remove id 0 subflow & address Geliang Tang
2023-10-08 10:27 ` [PATCH mptcp-next v11 1/4] mptcp: set next subflow to msk->first Geliang Tang
2023-10-08 11:11   ` Matthieu Baerts
2023-10-08 12:33     ` Geliang Tang
2023-10-08 14:05       ` Matthieu Baerts
2023-10-10  6:04         ` Geliang Tang [this message]
2023-10-10 12:28           ` Matthieu Baerts
2023-10-08 10:27 ` [PATCH mptcp-next v11 2/4] selftests: mptcp: userspace pm remove initial subflow Geliang Tang
2023-10-08 11:13   ` Matthieu Baerts
2023-10-08 11:22   ` Matthieu Baerts
2023-10-08 10:27 ` [PATCH mptcp-next v11 3/4] mptcp: userspace pm remove id 0 address Geliang Tang
2023-10-08 11:19   ` Matthieu Baerts
2023-10-08 10:27 ` [PATCH mptcp-next v11 4/4] selftests: " Geliang Tang
2023-10-08 11:25   ` Matthieu Baerts
2023-10-08 12:20   ` selftests: mptcp: userspace pm remove id 0 address: Tests Results 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=20231010060403.GA6593@localhost.localdomain \
    --to=geliang.tang@suse.com \
    --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 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.