[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <baamf74wjdpk7ji3hmsyzjr6ngu52qq6au6gcnc5vahlacpenx@rccaffrt6vub>
Date: Fri, 18 Apr 2025 12:07:01 +0200
From: Stefano Garzarella <sgarzare@...hat.com>
To: Michal Luczaj <mhal@...x.co>
Cc: Paolo Abeni <pabeni@...hat.com>,
"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 Wed, Apr 16, 2025 at 02:36:52PM +0200, Michal Luczaj wrote:
>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?
>
If this is the case, I would say mimic TCP for now.
Thanks,
Stefano
Powered by blists - more mailing lists