[Devel] [PATCH VZ10] vhost/vsock: don't purge send_pkt_queue on VHOST_RESET_OWNER #VSTOR-130976
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Fri May 15 13:37:09 MSK 2026
On 5/12/26 18:07, Andrey Drobyshev wrote:
> Commit 6ff9ad917553 ("vhost/vsock: add VHOST_RESET_OWNER ioctl") added
> support for VHOST_RESET_OWNER specifically to let QEMU hand
> /dev/vhost-vsock from a dying task to a freshly exec()ed one during
> qemu-update (cpr-exec), without tearing down in-flight AF_VSOCK
> connections.
>
> However, current implementation unconditionally calls
>
> virtio_vsock_skb_queue_purge(&vsock->send_pkt_queue);
>
> after vhost_dev_stop() in vhost_vsock_reset_owner(). The queue holds
> host<-->guest skbs submitted by the host kernel's AF_VSOCK layer. Those
> skbs should be owned by the connection itself (which we're trying to
> preserve), not by the userspace task whose ownership is being reset. The
> delivery of those packets is still required for the connections to remain
> consistent.
>
> Currently, with the queue being purged, we observe data loss (or even a
> deadlock) when performing qemu-update operation during data transfer
> through vhost-vsock channel. Let's get rid of it here. The purge still
> happens upon device release in vhost_vsock_dev_release(), so no skbs
> should be leaked here.
>
> Fixes: 6ff9ad917553 ("vhost/vsock: add VHOST_RESET_OWNER ioctl")
> https://virtuozzo.atlassian.net/browse/VSTOR-130976
Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
>
> Signed-off-by: Andrey Drobyshev <andrey.drobyshev at virtuozzo.com>
>
> Feature: vhost-vsock: VHOST_RESET_OWNER ioctl
> ---
> drivers/vhost/vsock.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
> index fa9a52824080..edc15f725926 100644
> --- a/drivers/vhost/vsock.c
> +++ b/drivers/vhost/vsock.c
> @@ -857,7 +857,6 @@ static int vhost_vsock_reset_owner(struct vhost_vsock *vsock)
> vhost_vsock_drop_backends(vsock);
> vhost_vsock_flush(vsock);
> vhost_dev_stop(&vsock->dev);
> - virtio_vsock_skb_queue_purge(&vsock->send_pkt_queue);
> vhost_dev_reset_owner(&vsock->dev, umem);
> done:
> mutex_unlock(&vsock->dev.mutex);
--
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.
More information about the Devel
mailing list