Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: kuniyu@google.com
Cc: edumazet@kernel.org, ncardwell@google.com, davem@davemloft.net,
	kuba@kernel.org, pabeni@redhat.com, willemb@google.com,
	horms@kernel.org, ycheng@google.com, kuni1840@gmail.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH v1 net] tcp: Skip active TFO blackhole detection for passive sockets.
Date: Wed, 02 Dec 2026 22:42:13 +0000	[thread overview]
Message-ID: <179625133368.3146.16470207858099388766@kernel.org> (raw)
In-Reply-To: <20261201104011.2286047-1-kuniyu@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The patch only partly achieves what its subject says, "Skip
  active TFO blackhole detection for passive sockets".

--

tcp: Skip active TFO blackhole detection for passive sockets.

This patch removes the tp->syn_data_acked term from the check in
tcp_fastopen_active_detect_blackhole(). tcp_fastopen_add_skb() sets that
bit on passive TFO children, so consecutive RTOs on a passive socket
could pause active TFO for the whole netns.

> diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
> index 7f7eb3cc1c04c..61e57f21e4e41 100644
> --- a/net/ipv4/tcp_fastopen.c
> +++ b/net/ipv4/tcp_fastopen.c
> @@ -685,7 +685,7 @@ void tcp_fastopen_active_detect_blackhole(struct sock *sk, bool expired)
>  	 * Fast Open globally after hitting the third consecutive timeout or
>  	 * exceeding the configured timeout limit.
>  	 */
> -	if ((tp->syn_fastopen || tp->syn_data || tp->syn_data_acked) &&
> +	if ((tp->syn_fastopen || tp->syn_data) &&
>  	    (timeouts == 2 || (timeouts < 2 && expired))) {
>  		tcp_fastopen_active_disable(sk);
>  		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENACTIVEFAIL);

[Severity: Medium]
Can tp->syn_fastopen or tp->syn_data still be set on a passive socket
here?

The active side sets these bits in tcp_syn_options() and
tcp_send_syn_data(). The only place either one gets cleared is the
transmit error path in tcp_send_syn_data():

net/ipv4/tcp_output.c:tcp_send_syn_data() {
    ...
	if (!err) {
		tp->syn_data = (fo->copied > 0);
    ...
	if (err)
		tp->syn_fastopen = 0;
    ...
}

tcp_disconnect() only resets the other two bits:

net/ipv4/tcp.c:tcp_disconnect() {
    ...
	tp->syn_data_acked = 0;
	tp->syn_fastopen_child = 0;
    ...
}

Consider a socket that does an active TFO connect (MSG_FASTOPEN or
TCP_FASTOPEN_CONNECT), then connect(AF_UNSPEC), then listen().
__inet_stream_connect() calls tcp_disconnect() and moves the socket back
to SS_UNCONNECTED / TCP_CLOSE, so listen() is allowed. The new listener
still has syn_fastopen and syn_data set.

Every child of that listener gets a copy of those bits, because the
whole tcp_sock is copied:

tcp_create_openreq_child()
  inet_csk_clone_lock()
    sk_clone_lock()
      sock_copy()

tcp_create_openreq_child() does not clear syn_fastopen or syn_data.
Suppose one of these children, TFO or not, hits its third consecutive
RTO:

tcp_write_timeout()
  tcp_fastopen_active_detect_blackhole()
    tcp_fastopen_active_disable()

In that case the check above still passes. Active TFO is then paused for
the whole netns when tcp_fastopen_blackhole_timeout_sec is non-zero, and
TCPFastOpenActiveFail is incremented either way. This is the symptom the
commit message describes.

A reused active socket that later reconnects without TFO keeps the same
stale bits, so it would be treated as a TFO connection in the same way.

The syn_fastopen_child early return mentioned in the commit message would
only cover the TFO children of such a listener. Would it make sense to
also clear syn_fastopen and syn_data in tcp_disconnect(), or on the child
in tcp_create_openreq_child()?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201104011.2286047-1-kuniyu%40google.com

      parent reply	other threads:[~2026-12-02 22:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 10:40 [PATCH v1 net] tcp: Skip active TFO blackhole detection for passive sockets Kuniyuki Iwashima
2026-12-01 12:24 ` Jiayuan Chen
2026-12-01 17:28 ` Yuchung Cheng
2026-12-02 22:42 ` netdev-bot+sashiko [this message]

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=179625133368.3146.16470207858099388766@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@google.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    --cc=ycheng@google.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