Commit 2fc06c4a authored by Michael Roth's avatar Michael Roth Committed by Paolo Bonzini
Browse files

Revert "qdev: Free QemuOpts when the QOM path goes away"



This reverts commit abed886e.

This patch originally addressed an issue where a DEVICE_DELETED
event could be emitted (in device_unparent()) before a Device's
QemuOpts were cleaned up (in device_finalize()), leading to a
"duplicate ID" error if management attempted to immediately add
a device with the same ID in response to the DEVICE_DELETED event.

An alternative will be implemented in a subsequent patch where we
defer the DEVICE_DELETED event until device_finalize(), which would
also prevent the race, so we revert the original fix in preparation.

Signed-off-by: default avatarMichael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
Tested-by: default avatarEric Auger <eric.auger@redhat.com>
Reviewed-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
Message-Id: <20171016222315.407-3-mdroth@linux.vnet.ibm.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 04162f8f
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -1069,6 +1069,7 @@ static void device_finalize(Object *obj)
    NamedGPIOList *ngl, *next;

    DeviceState *dev = DEVICE(obj);
    qemu_opts_del(dev->opts);

    QLIST_FOREACH_SAFE(ngl, &dev->gpios, node, next) {
        QLIST_REMOVE(ngl, node);
@@ -1118,9 +1119,6 @@ static void device_unparent(Object *obj)
        g_free(dev->canonical_path);
        dev->canonical_path = NULL;
    }

    qemu_opts_del(dev->opts);
    dev->opts = NULL;
}

static void device_class_init(ObjectClass *class, void *data)