MPTCP Linux Development
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang.tang@suse.com>, mptcp@lists.linux.dev
Cc: Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH mptcp-next v12 1/5] mptcp: avoid resetting when another subflow available
Date: Mon, 9 Oct 2023 18:13:19 +0200	[thread overview]
Message-ID: <76f31a37-16b4-4e3a-8b00-fdb2c1eabfb4@kernel.org> (raw)
In-Reply-To: <2b69fa22510db02a12eb101c3e8173dda76f8133.1696831239.git.geliang.tang@suse.com>

Hi Geliang,

On 09/10/2023 08:02, Geliang Tang wrote:
> When closing the msk->first socket in __mptcp_close_ssk(), if there's
> another subflow available, it's better to avoid resetting it.
> 
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
>  net/mptcp/protocol.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 30e0c29ae0a4..6346a164ed66 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -2396,7 +2396,7 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,
>  		goto out_release;
>  	}
>  
> -	dispose_it = msk->free_first || ssk != msk->first;
> +	dispose_it = msk->free_first || ssk != msk->first || !list_is_singular(&msk->conn_list);
>  	if (dispose_it)
>  		list_del(&subflow->node);
>  
> @@ -2446,7 +2446,7 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,
>  
>  	sock_put(ssk);
>  
> -	if (ssk == msk->first)
> +	if (ssk == msk->first && list_is_singular(&msk->conn_list))
>  		WRITE_ONCE(msk->first, NULL);

I don't think we should 'dispose it' nor set 'msk->first' to NULL but
instead, we should not call tcp_disconnect() directly: if the connection
is still in ESTABLISHED, tcp_disconnect() will send a RST if I'm not
mistaken. That's what we want to avoid, no?

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

  reply	other threads:[~2023-10-09 16:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09  6:02 [PATCH mptcp-next v12 0/5] userspace pm remove id 0 subflow & address Geliang Tang
2023-10-09  6:02 ` [PATCH mptcp-next v12 1/5] mptcp: avoid resetting when another subflow available Geliang Tang
2023-10-09 16:13   ` Matthieu Baerts [this message]
2023-10-10  6:13     ` Geliang Tang
2023-10-10 12:49       ` Matthieu Baerts
2023-10-10 16:20   ` Paolo Abeni
2023-10-09  6:02 ` [PATCH mptcp-next v12 2/5] selftests: mptcp: userspace pm remove initial subflow Geliang Tang
2023-10-09  6:02 ` [PATCH mptcp-net v12 3/5] mptcp: userspace pm send RM_ADDR for ID 0 Geliang Tang
2023-10-09  6:02 ` [PATCH mptcp-next v12 4/5] mptcp: userspace pm rename remove_err to out Geliang Tang
2023-10-09  6:03 ` [PATCH mptcp-next v12 5/5] selftests: mptcp: userspace pm send RM_ADDR for ID 0 Geliang Tang
2023-10-09  7:05   ` selftests: mptcp: userspace pm send RM_ADDR for ID 0: 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=76f31a37-16b4-4e3a-8b00-fdb2c1eabfb4@kernel.org \
    --to=matttbe@kernel.org \
    --cc=geliang.tang@suse.com \
    --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