Received: from eggs.gnu.org ([208.118.235.92]:38572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5m5F-0004ff-5N for qemu-devel@nongnu.org; Sun, 26 Aug 2012 19:17:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T5m5E-0003cz-6w for qemu-devel@nongnu.org; Sun, 26 Aug 2012 19:17:33 -0400 Received: from cpe-70-123-140-180.austin.res.rr.com ([70.123.140.180]:50521 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5m5D-0003cZ-WD for qemu-devel@nongnu.org; Sun, 26 Aug 2012 19:17:32 -0400 From: Anthony Liguori Date: Sun, 26 Aug 2012 10:51:30 -0500 Message-Id: <1345996298-4892-2-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1345996298-4892-1-git-send-email-aliguori@us.ibm.com> References: <1345996298-4892-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 1/9] savevm: don't rely on paths if we can store a DeviceState object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Anthony Liguori , Liu Ping Fan , Andreas Faerber Paths break during tear down which can result in odd behavior since we do path based lookup during unregister (which happens at tear down). For devices, just store the DeviceState directly and use that. Signed-off-by: Anthony Liguori --- savevm.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/savevm.c b/savevm.c index c7fe283..bb6494b 100644 --- a/savevm.c +++ b/savevm.c @@ -1177,6 +1177,7 @@ typedef struct SaveStateEntry { CompatEntry *compat; int no_migrate; int is_ram; + DeviceState *dev; } SaveStateEntry; @@ -1235,6 +1236,7 @@ int register_savevm_live(DeviceState *dev, se->opaque = opaque; se->vmsd = NULL; se->no_migrate = 0; + se->dev = dev; /* if this is a live_savem then set is_ram */ if (ops->save_live_setup != NULL) { se->is_ram = 1; @@ -1298,7 +1300,8 @@ void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque) pstrcat(id, sizeof(id), idstr); QTAILQ_FOREACH_SAFE(se, &savevm_handlers, entry, new_se) { - if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) { + if ((dev && se->dev == dev) || + (strcmp(se->idstr, id) == 0 && se->opaque == opaque)) { QTAILQ_REMOVE(&savevm_handlers, se, entry); if (se->compat) { g_free(se->compat); -- 1.7.5.4