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

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