From: Michal Luczaj <mhal@rbox.co>
To: Stefano Garzarella <sgarzare@redhat.com>,
Paolo Abeni <pabeni@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Simon Horman" <horms@kernel.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
virtualization@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH net-next 1/2] vsock: Linger on unsent data
Date: Wed, 16 Apr 2025 14:36:52 +0200 [thread overview]
Message-ID: <a3ed036f-5153-4d4c-bf71-70b060dd5b2f@rbox.co> (raw)
In-Reply-To: <hu4kfdobwdhrvlm5egbbfzxjiyi6q32666hpdinywi2fd5kl5j@36dvktqp753a>
On 4/11/25 12:32, Stefano Garzarella wrote:
> On Thu, Apr 10, 2025 at 12:51:48PM +0200, Paolo Abeni wrote:
>> On 4/7/25 8:41 PM, Michal Luczaj wrote:
>>> Change the behaviour of a lingering close(): instead of waiting for all
>>> data to be consumed, block until data is considered sent, i.e. until worker
>>> picks the packets and decrements virtio_vsock_sock::bytes_unsent down to 0.
>>
>> I think it should be better to expand the commit message explaining the
>> rationale.
Sure, will do.
>>> Do linger on shutdown() just as well.
>>
>> Why? Generally speaking shutdown() is not supposed to block. I think you
>> should omit this part.
>
> I thought the same, but discussing with Michal we discovered this on
> socket(7) man page:
>
> SO_LINGER
> Sets or gets the SO_LINGER option. The argument is a
> linger structure.
>
> struct linger {
> int l_onoff; /* linger active */
> int l_linger; /* how many seconds to linger for */
> };
>
> When enabled, a close(2) or shutdown(2) will not return
> until all queued messages for the socket have been
> successfully sent or the linger timeout has been reached.
> Otherwise, the call returns immediately and the closing is
> done in the background. When the socket is closed as part
> of exit(2), it always lingers in the background.
>
> In AF_VSOCK we supported SO_LINGER only on close(), but it seems that
> shutdown must also do it from the manpage.
Even though shutdown() lingering isn't universally implemented :/
If I'm reading the code correctly, TCP lingers only on close(). So,
following the man page on the one hand, mimicking TCP on the other?
next prev parent reply other threads:[~2025-04-16 12:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 18:41 [PATCH net-next 0/2] vsock: SOCK_LINGER rework Michal Luczaj
2025-04-07 18:41 ` [PATCH net-next 1/2] vsock: Linger on unsent data Michal Luczaj
2025-04-10 10:51 ` Paolo Abeni
2025-04-11 10:32 ` Stefano Garzarella
2025-04-16 12:36 ` Michal Luczaj [this message]
2025-04-18 10:07 ` Stefano Garzarella
2025-04-11 13:43 ` Stefano Garzarella
2025-04-21 21:52 ` Michal Luczaj
2025-04-07 18:41 ` [PATCH net-next 2/2] vsock/test: Expand linger test to ensure close() does not misbehave Michal Luczaj
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=a3ed036f-5153-4d4c-bf71-70b060dd5b2f@rbox.co \
--to=mhal@rbox.co \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=horms@kernel.org \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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
all inboxes | Powered by JetHome®