[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a3ed036f-5153-4d4c-bf71-70b060dd5b2f@rbox.co>
Date: Wed, 16 Apr 2025 14:36:52 +0200
From: Michal Luczaj <mhal@...x.co>
To: Stefano Garzarella <sgarzare@...hat.com>, Paolo Abeni <pabeni@...hat.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Simon Horman <horms@...nel.org>, "Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>, Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Eugenio Pérez <eperezma@...hat.com>,
Stefan Hajnoczi <stefanha@...hat.com>, virtualization@...ts.linux.dev,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: Re: [PATCH net-next 1/2] vsock: Linger on unsent data
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?
Powered by blists - more mailing lists