From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1Yxp-0005ZZ-Tv for qemu-devel@nongnu.org; Sat, 14 May 2016 08:46:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b1Yxl-0006xE-UQ for qemu-devel@nongnu.org; Sat, 14 May 2016 08:46:37 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:3589 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1Yxl-0006wz-GY for qemu-devel@nongnu.org; Sat, 14 May 2016 08:46:33 -0400 From: "Denis V. Lunev" Date: Sat, 14 May 2016 15:45:57 +0300 Message-Id: <1463229957-14253-10-git-send-email-den@openvz.org> In-Reply-To: <1463229957-14253-1-git-send-email-den@openvz.org> References: <1463229957-14253-1-git-send-email-den@openvz.org> Subject: [Qemu-devel] [PATCH 09/10] block: fix backup in vmdk format image List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: den@openvz.org, Pavel Butsykin , Jeff Cody , Markus Armbruster , Eric Blake , John Snow , Stefan Hajnoczi , Kevin Wolf From: Pavel Butsykin 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 Signed-off-by: Denis V. Lunev CC: Jeff Cody CC: Markus Armbruster CC: Eric Blake CC: John Snow CC: Stefan Hajnoczi CC: Kevin Wolf --- 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); + } } } -- 2.1.4