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


Reply via email to