[PATCH net-next v4 0/3] vsock: SOCK_LINGER rework

From: Michal Luczaj
Date: Thu May 01 2025 - 04:06:14 EST


Change vsock's lingerning to wait on close() until all data is sent, i.e.
until workers picked all the packets for processing.

Changes in v4:
- While in virtio, stick to virtio_transport_unsent_bytes() [Stefano]
- Squash the indentation reduction [Stefano]
- Pull SOCK_LINGER check into vsock_linger() [Stefano]
- Don't explicitly pass sk->sk_lingertime [Stefano]
- Link to v3: https://lore.kernel.org/r/20250430-vsock-linger-v3-0-ddbe73b53457@xxxxxxx

Changes in v3:
- Set "vsock/virtio" topic where appropriate
- Do not claim that Hyper-V and VMCI ever lingered [Stefano]
- Move lingering to af_vsock core [Stefano]
- Link to v2: https://lore.kernel.org/r/20250421-vsock-linger-v2-0-fe9febd64668@xxxxxxx

Changes in v2:
- Comment that some transports do not implement unsent_bytes [Stefano]
- Reduce the indentation of virtio_transport_wait_close() [Stefano]
- Do not linger on shutdown(), expand the commit messages [Paolo]
- Link to v1: https://lore.kernel.org/r/20250407-vsock-linger-v1-0-1458038e3492@xxxxxxx

Changes in v1:
- Do not assume `unsent_bytes()` is implemented by all transports [Stefano]
- Link to v0: https://lore.kernel.org/netdev/df2d51fd-03e7-477f-8aea-938446f47864@xxxxxxx/

Signed-off-by: Michal Luczaj <mhal@xxxxxxx>
---
Michal Luczaj (3):
vsock/virtio: Linger on unsent data
vsock: Move lingering logic to af_vsock core
vsock/test: Expand linger test to ensure close() does not misbehave

include/net/af_vsock.h | 1 +
net/vmw_vsock/af_vsock.c | 30 ++++++++++++++++++++++++++++++
net/vmw_vsock/virtio_transport_common.c | 21 ++-------------------
tools/testing/vsock/vsock_test.c | 30 +++++++++++++++++++++++++++---
4 files changed, 60 insertions(+), 22 deletions(-)
---
base-commit: deeed351e982ac4d521598375b34b071304533b0
change-id: 20250304-vsock-linger-9026e5f9986c

Best regards,
--
Michal Luczaj <mhal@xxxxxxx>