Blame SOURCES/kvm-Revert-qdev-Free-QemuOpts-when-the-QOM-path-goes-awa.patch

4a2fec
From 8edc99e92cf93764e190e69d3f970bdf6de606e0 Mon Sep 17 00:00:00 2001
4a2fec
From: Serhii Popovych <spopovyc@redhat.com>
4a2fec
Date: Thu, 9 Nov 2017 15:30:04 +0100
4a2fec
Subject: [PATCH 4/7] Revert "qdev: Free QemuOpts when the QOM path goes away"
4a2fec
4a2fec
RH-Author: Serhii Popovych <spopovyc@redhat.com>
4a2fec
Message-id: <1510241405-20597-3-git-send-email-spopovyc@redhat.com>
4a2fec
Patchwork-id: 77630
4a2fec
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 2/3] Revert "qdev: Free QemuOpts when the QOM path goes away"
4a2fec
Bugzilla: 1445460
4a2fec
RH-Acked-by: David Gibson <dgibson@redhat.com>
4a2fec
RH-Acked-by: Thomas Huth <thuth@redhat.com>
4a2fec
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
4a2fec
4a2fec
From: Michael Roth <mdroth@linux.vnet.ibm.com>
4a2fec
4a2fec
This reverts commit abed886ec60cf239a03515cf0b30fb11fa964c44.
4a2fec
4a2fec
This patch originally addressed an issue where a DEVICE_DELETED
4a2fec
event could be emitted (in device_unparent()) before a Device's
4a2fec
QemuOpts were cleaned up (in device_finalize()), leading to a
4a2fec
"duplicate ID" error if management attempted to immediately add
4a2fec
a device with the same ID in response to the DEVICE_DELETED event.
4a2fec
4a2fec
An alternative will be implemented in a subsequent patch where we
4a2fec
defer the DEVICE_DELETED event until device_finalize(), which would
4a2fec
also prevent the race, so we revert the original fix in preparation.
4a2fec
4a2fec
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
4a2fec
Reviewed-by: Greg Kurz <groug@kaod.org>
4a2fec
Tested-by: Eric Auger <eric.auger@redhat.com>
4a2fec
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
4a2fec
Message-Id: <20171016222315.407-3-mdroth@linux.vnet.ibm.com>
4a2fec
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
(cherry picked from commit 2fc06c4ac65594ad248e9a9150ebdde9ff5a1253)
4a2fec
Signed-off-by: Serhii Popovych <spopovyc@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 hw/core/qdev.c | 4 +---
4a2fec
 1 file changed, 1 insertion(+), 3 deletions(-)
4a2fec
4a2fec
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
4a2fec
index 0019a49..418cdac 100644
4a2fec
--- a/hw/core/qdev.c
4a2fec
+++ b/hw/core/qdev.c
4a2fec
@@ -1069,6 +1069,7 @@ static void device_finalize(Object *obj)
4a2fec
     NamedGPIOList *ngl, *next;
4a2fec
 
4a2fec
     DeviceState *dev = DEVICE(obj);
4a2fec
+    qemu_opts_del(dev->opts);
4a2fec
 
4a2fec
     QLIST_FOREACH_SAFE(ngl, &dev->gpios, node, next) {
4a2fec
         QLIST_REMOVE(ngl, node);
4a2fec
@@ -1118,9 +1119,6 @@ static void device_unparent(Object *obj)
4a2fec
         g_free(dev->canonical_path);
4a2fec
         dev->canonical_path = NULL;
4a2fec
     }
4a2fec
-
4a2fec
-    qemu_opts_del(dev->opts);
4a2fec
-    dev->opts = NULL;
4a2fec
 }
4a2fec
 
4a2fec
 static void device_class_init(ObjectClass *class, void *data)
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec