[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <hu4kfdobwdhrvlm5egbbfzxjiyi6q32666hpdinywi2fd5kl5j@36dvktqp753a>
Date: Fri, 11 Apr 2025 12:32:31 +0200
From: Stefano Garzarella <sgarzare@...hat.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Michal Luczaj <mhal@...x.co>, "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 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.
>
>> 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.
Thanks,
Stefano
Powered by blists - more mailing lists