From 1e24450789fc31ba73d025d8960b50096d6870a1 Mon Sep 17 00:00:00 2001 From: Marcel Apfelbaum Date: Thu, 24 Sep 2015 17:04:00 +0200 Subject: [PATCH 05/13] vhost-user: Send VHOST_RESET_OWNER on vhost stop Message-id: <1443114248-18614-4-git-send-email-marcel@redhat.com> Patchwork-id: 67937 O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 03/11] vhost-user: Send VHOST_RESET_OWNER on vhost stop Bugzilla: 1207687 RH-Acked-by: Victor Kaplansky RH-Acked-by: Xiao Wang RH-Acked-by: Michael S. Tsirkin From: Luke Gorrie Ensure that the vhost-user slave knows when the vrings are valid and when they are invalid, for example during a guest reboot. The vhost-user protocol says this of VHOST_RESET_OWNER: Issued when a new connection is about to be closed. The Master will no longer own this connection (and will usually close it). Send this message to tell the vhost-user slave that the vhost session has ended and that session state (e.g. vrings) is no longer valid. Signed-off-by: Luke Gorrie Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit 294ce717e0f212ed0763307f3eab72b4a1bdf4d0) Signed-off-by: Marcel Apfelbaum Signed-off-by: Miroslav Rezanina --- hw/net/vhost_net.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index feba86d..5c1d11f 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -282,6 +282,13 @@ static void vhost_net_stop_one(struct vhost_net *net, &file); assert(r >= 0); } + } else if (net->nc->info->type == NET_CLIENT_OPTIONS_KIND_VHOST_USER) { + for (file.index = 0; file.index < net->dev.nvqs; ++file.index) { + const VhostOps *vhost_ops = net->dev.vhost_ops; + int r = vhost_ops->vhost_call(&net->dev, VHOST_RESET_OWNER, + NULL); + assert(r >= 0); + } } if (net->nc->info->poll) { net->nc->info->poll(net->nc, true); -- 1.8.3.1