From: "luwei (O)" <luwei32@huawei.com>
To: <edumazet@google.com>, <davem@davemloft.net>,
<yoshfuji@linux-ipv6.org>, <dsahern@kernel.org>,
<kuba@kernel.org>, <pabeni@redhat.com>, <xemul@parallels.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <ovzxemul@gmail.com>, <ptikhomirov@virtuozzo.com>, <den@virtuozzo.com>
Subject: Re: [PATCH net v2] tcp: reset tp->sacked_out when sack is enabled
Date: Thu, 27 Oct 2022 19:04:29 +0800 [thread overview]
Message-ID: <a4a6186e-e5e7-f9e9-3ba9-b9b8a9a1f37e@huawei.com> (raw)
In-Reply-To: <20221027114930.137735-1-luwei32@huawei.com>
please ignore this patch, I forgot to change the title
在 2022/10/27 7:49 PM, Lu Wei 写道:
> If setsockopt with option name of TCP_REPAIR_OPTIONS and opt_code
> of TCPOPT_SACK_PERM is called to enable sack after data is sent
> and before data is acked, it will trigger a warning in function
> tcp_verify_left_out() as follows:
>
> ============================================
> WARNING: CPU: 8 PID: 0 at net/ipv4/tcp_input.c:2132
> tcp_timeout_mark_lost+0x154/0x160
> tcp_enter_loss+0x2b/0x290
> tcp_retransmit_timer+0x50b/0x640
> tcp_write_timer_handler+0x1c8/0x340
> tcp_write_timer+0xe5/0x140
> call_timer_fn+0x3a/0x1b0
> __run_timers.part.0+0x1bf/0x2d0
> run_timer_softirq+0x43/0xb0
> __do_softirq+0xfd/0x373
> __irq_exit_rcu+0xf6/0x140
>
> This warning occurs in several steps:
> Step1. If sack is not enabled, when server receives dup-ack,
> it calls tcp_add_reno_sack() to increase tp->sacked_out.
>
> Step2. Setsockopt() is called to enable sack
>
> Step3. The retransmit timer expires, it calls tcp_timeout_mark_lost()
> to increase tp->lost_out but not clear tp->sacked_out because
> sack is enabled and tcp_is_reno() is false.
>
> So tp->left_out is increased repeatly in Step1 and Step3 and it is
> greater than tp->packets_out and trigger the warning. In function
> tcp_timeout_mark_lost(), tp->sacked_out will be cleared if Step2 not
> happen and the warning will not be triggered. As suggested by Denis
> and Eric, TCP_REPAIR_OPTIONS should be prohibited if data was already
> sent.
>
> socket-tcp tests in CRIU has been tested as follows:
> $ sudo ./test/zdtm.py run -t zdtm/static/socket-tcp* --keep-going \
> --ignore-taint
>
> socket-tcp* represent all socket-tcp tests in test/zdtm/static/.
>
> Fixes: b139ba4e90dc ("tcp: Repair connection-time negotiated parameters")
> Signed-off-by: Lu Wei <luwei32@huawei.com>
> ---
> net/ipv4/tcp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index ef14efa1fb70..ef876e70f7fe 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -3647,7 +3647,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,
> case TCP_REPAIR_OPTIONS:
> if (!tp->repair)
> err = -EINVAL;
> - else if (sk->sk_state == TCP_ESTABLISHED)
> + else if (sk->sk_state == TCP_ESTABLISHED && !tp->packets_out)
> err = tcp_repair_options_est(sk, optval, optlen);
> else
> err = -EPERM;
--
Best Regards,
Lu Wei
next prev parent reply other threads:[~2022-10-27 11:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 11:49 Lu Wei
2022-10-27 11:04 ` luwei (O) [this message]
2022-10-27 11:08 ` Eric Dumazet
[not found] ` <CA+XRDbMX2q3MvxEEHVfkFD93pxHJ7-emLTbvj2UOBpUx_8tMtA@mail.gmail.com>
2022-10-27 11:18 ` Eric Dumazet
2022-10-27 13:32 ` luwei (O)
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=a4a6186e-e5e7-f9e9-3ba9-b9b8a9a1f37e@huawei.com \
--to=luwei32@huawei.com \
--cc=davem@davemloft.net \
--cc=den@virtuozzo.com \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ovzxemul@gmail.com \
--cc=pabeni@redhat.com \
--cc=ptikhomirov@virtuozzo.com \
--cc=xemul@parallels.com \
--cc=yoshfuji@linux-ipv6.org \
/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
all inboxes | Powered by JetHome®