From a1fd8f3e5f2faeccd08a617c0208dd786cf4a6d7 Mon Sep 17 00:00:00 2001
From: Julia Suvorova <jusual@redhat.com>
Date: Wed, 4 Mar 2020 20:07:54 -0500
Subject: [PATCH 12/12] virtio-net: delete also control queue when TX/RX
deleted
RH-Author: Julia Suvorova <jusual@redhat.com>
Message-id: <20200304200754.32708-5-jusual@redhat.com>
Patchwork-id: 94155
O-Subject: [RHEL-7.9 qemu-kvm-rhev PATCH 4/4] virtio-net: delete also control queue when TX/RX deleted
Bugzilla: 1721403
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
From: Yuri Benditovich <yuri.benditovich@daynix.com>
https://bugzilla.redhat.com/show_bug.cgi?id=1708480
If the control queue is not deleted together with TX/RX, it
later will be ignored in freeing cache resources and hot
unplug will not be completed.
Cc: qemu-stable@nongnu.org
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
Message-Id: <20191226043649.14481-3-yuri.benditovich@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit d945d9f1731244ef341f74ede93120fc9de35913)
Signed-off-by: Jon Maloy <jmaloy.redhat.com>
---
hw/net/virtio-net.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 90502fca7c..c4896184ed 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -2100,8 +2100,12 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)
virtio_net_del_queue(n, i);
}
+ /* delete also control vq */
+ virtio_del_queue(vdev, max_queues * 2);
+
timer_del(n->announce_timer);
timer_free(n->announce_timer);
+
g_free(n->vqs);
qemu_del_nic(n->nic);
virtio_cleanup(vdev);
--
2.18.2