[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 09/10] block: fix backup in vmdk format image

From: Denis V. Lunev
Subject: [Qemu-devel] [PATCH 09/10] block: fix backup in vmdk format image
Date: Sat, 14 May 2016 15:45:57 +0300

From: Pavel Butsykin <address@hidden>

The vmdk format has the extents and bs->file can be equal to the first
extension. Before start of the backup we do detach the old context on the
target drive at the bdrv_attach_aio_context. For the vmdk drive this means
a double detach of the same block driver state, because the detach occurs
for s->extents[0].file and bs->file.

To fix we  just skip the detach if s->extents[i].file and bs->file are the
same. This approach is already used in the vmdk_free_extents() and the
vmdk_get_allocated_file_size(), so it won't be some innovation :)

Signed-off-by: Pavel Butsykin <address@hidden>
Signed-off-by: Denis V. Lunev <address@hidden>
CC: Jeff Cody <address@hidden>
CC: Markus Armbruster <address@hidden>
CC: Eric Blake <address@hidden>
CC: John Snow <address@hidden>
CC: Stefan Hajnoczi <address@hidden>
CC: Kevin Wolf <address@hidden>
 block/vmdk.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index 9530b30..0550924 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -2305,7 +2305,10 @@ static void vmdk_detach_aio_context(BlockDriverState *bs)
     int i;
     for (i = 0; i < s->num_extents; i++) {
-        bdrv_detach_aio_context(s->extents[i].file->bs);
+        BdrvChild *file = s->extents[i].file;
+        if (file != bs->file) {
+            bdrv_detach_aio_context(file->bs);
+        }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]