From: Paolo Abeni <pabeni@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>, netdev@vger.kernel.org
Cc: Michal Luczaj <mhal@rbox.co>,
George Zhang <georgezhang@vmware.com>,
virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
Andy King <acking@vmware.com>, Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Dmitry Torokhov <dtor@vmware.com>,
Simon Horman <horms@kernel.org>,
Luigi Leonardi <leonardi@redhat.com>
Subject: Re: [PATCH net] vsock: avoid timeout during connect() if the socket is closing
Date: Tue, 1 Apr 2025 13:56:25 +0200 [thread overview]
Message-ID: <0a240ac2-3280-4831-8db2-214cb6e45f0b@redhat.com> (raw)
In-Reply-To: <20250328141528.420719-1-sgarzare@redhat.com>
On 3/28/25 3:15 PM, Stefano Garzarella wrote:
> From: Stefano Garzarella <sgarzare@redhat.com>
>
> When a peer attempts to establish a connection, vsock_connect() contains
> a loop that waits for the state to be TCP_ESTABLISHED. However, the
> other peer can be fast enough to accept the connection and close it
> immediately, thus moving the state to TCP_CLOSING.
>
> When this happens, the peer in the vsock_connect() is properly woken up,
> but since the state is not TCP_ESTABLISHED, it goes back to sleep
> until the timeout expires, returning -ETIMEDOUT.
>
> If the socket state is TCP_CLOSING, waiting for the timeout is pointless.
> vsock_connect() can return immediately without errors or delay since the
> connection actually happened. The socket will be in a closing state,
> but this is not an issue, and subsequent calls will fail as expected.
>
> We discovered this issue while developing a test that accepts and
> immediately closes connections to stress the transport switch between
> two connect() calls, where the first one was interrupted by a signal
> (see Closes link).
>
> Reported-by: Luigi Leonardi <leonardi@redhat.com>
> Closes: https://lore.kernel.org/virtualization/bq6hxrolno2vmtqwcvb5bljfpb7mvwb3kohrvaed6auz5vxrfv@ijmd2f3grobn/
> Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
next prev parent reply other threads:[~2025-04-01 11:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 14:15 Stefano Garzarella
2025-04-01 11:56 ` Paolo Abeni [this message]
2025-04-01 12:27 ` Luigi Leonardi
2025-04-03 0:30 ` patchwork-bot+netdevbpf
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=0a240ac2-3280-4831-8db2-214cb6e45f0b@redhat.com \
--to=pabeni@redhat.com \
--cc=acking@vmware.com \
--cc=davem@davemloft.net \
--cc=dtor@vmware.com \
--cc=edumazet@google.com \
--cc=georgezhang@vmware.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=leonardi@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhal@rbox.co \
--cc=netdev@vger.kernel.org \
--cc=sgarzare@redhat.com \
--cc=virtualization@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 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®