mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Florian Westphal <fw@strlen.de>, mptcp@lists.linux.dev
Subject: Re: [PATCH RFC mptcp] net: tcp: prevent transition to FIN_WAIT2 when mptcp has unacked data_fin
Date: Mon, 22 Aug 2022 14:32:06 +0200	[thread overview]
Message-ID: <20220822123206.GF11586@breakpoint.cc> (raw)
In-Reply-To: <09c08d1262325db726f2d3d2d6e4efd351612a87.camel@redhat.com>

Paolo Abeni <pabeni@redhat.com> wrote:
> > Full test case stashed here for the time being:
> > https://github.com/fw-strlen/packetdrill/commit/60a3f57ea309f910643e06dbf123236741c7f8d9
> > 
> > Its possible to either change tw_sk to have enough mptcp context to be
> > able to send a packet back, or we can supress/delay the tw_sock
> > transition.  This is what classic TCP is doing when it receives another
> > FIN while in FIN1 state.
> > 
> > This change makes the test case work (another dss ack is sent), but
> > there may be other corner cases where we need to delay the sk ->
> > tw_sk transition.
> > 
> > If the general idea looks ok, perhaps its better to replace
> > 
> > tcp_time_wait(sk, skb, ..
> > 
> > with a mptcp aware helper, e.g.  tcp_time_wait_check(sk, skb, ..
> > and place the option parsing for mptcp-subflows there?
> 
> _if_ (big if) I read correctly, this patch "always" (most common
> shutdown sequence should match the condition checked here, right?)

Really?  I had to fudge with the test case a long time to get the needed
transition, I'm not even sure the test case is legit.

https://github.com/fw-strlen/packetdrill/commit/60a3f57ea309f910643e06dbf123236741c7f8d9

is that even correct?!
(See line 43f., it acks the tcp-level fin, but retransmits the data_fin).

> delay the tw_sk transiction for mptcp sockets, keeping alive the whole
> mptcp and subflow socks for a ??? timeout. Is that correct?

Yes.

> If so, and the mptcp_tw socket is not too invasive (again, big if), I
> think implementing the mptcp_tw could be better: a busy server could
> keep a lot of memory around for the shutting-down-socks.

Hmm, not sure, see above and below.

> I think the mptcp_tw will not need a reference to the mptcp sock, it
> just need to know the mptcp-level data_fin seq to be acked.

Agreed.

> > +		} else if (sk_is_mptcp(sk) &&
> > +			   mptcp_incoming_options(sk, skb) &&
> > +			   mptcp_subflow_pending_data_fin_ack(sk)) {
> 
> Possibly ENOCOFFEE here, but could the above 2 function being replaced
> by checking if the incoming packet carries a data_fin option?

Is that needed? AFAIU we ONLY need to respond if we have a pending
fin_ack, i.e. if we know the data_fin ack is completed we don't need to act?

If we need this unconditionally then of course your proposal makes more
sense, i would then rework this to handle this as an extension of
'tcp->fin set' case with same handling (pass to tcp_data_queue()).

> (not sure if worthy and its very subjective, it "sounds" a little bit
> clearer to me)
> 
> > +				inet_csk_schedule_ack(sk);
> 
> Why we explcitly need to schedule the ack, and the plain TCP-fin case
> does not need it?

Yes, I could rework this.  For normal tcp, there are two cases:
1. pure ack -> no action needed, transition to FIN_WAIT2 + mini-tw-socket
2. fin set -> pass the skb to tcp_data_queue (this can't be seen from
   the context diff, but this is where the skb will end up, this will
   then call tcp_fin() again.
   In this case, the socket doesn't move to tw state.

Thanks,
Florian

  reply	other threads:[~2022-08-22 12:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18 16:21 [PATCH RFC mptcp] net: tcp: prevent transition to FIN_WAIT2 when mptcp has unacked data_fin Florian Westphal
2022-08-18 18:40 ` net: tcp: prevent transition to FIN_WAIT2 when mptcp has unacked data_fin: Tests Results MPTCP CI
2022-08-19 15:20 ` [PATCH RFC mptcp] net: tcp: prevent transition to FIN_WAIT2 when mptcp has unacked data_fin Matthieu Baerts
2022-08-22 11:02 ` Paolo Abeni
2022-08-22 12:32   ` Florian Westphal [this message]
2022-08-23 15:54     ` Paolo Abeni
2022-09-02  9:17       ` Paolo Abeni

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=20220822123206.GF11586@breakpoint.cc \
    --to=fw@strlen.de \
    --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).