From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl1pr-0000gl-JV for qemu-devel@nongnu.org; Mon, 25 Nov 2013 14:28:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vl1pj-00027j-6x for qemu-devel@nongnu.org; Mon, 25 Nov 2013 14:28:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:25182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl1pi-00027b-TY for qemu-devel@nongnu.org; Mon, 25 Nov 2013 14:28:35 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAPJSW4G010654 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 25 Nov 2013 14:28:33 -0500 From: Max Reitz Date: Mon, 25 Nov 2013 20:28:55 +0100 Message-Id: <1385407736-13941-2-git-send-email-mreitz@redhat.com> In-Reply-To: <1385407736-13941-1-git-send-email-mreitz@redhat.com> References: <1385407736-13941-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH for-1.7 1/2] block/drive-mirror: Reuse backing HD for sync=none List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Stefan Hajnoczi , Max Reitz For "none" sync mode in "absolute-paths" mode, the current image should be used as the backing file for the newly created image. The current behavior is: a) If the image to be mirrored has a backing file, use that (which is wrong, since the operations recorded by "none" are applied to the image itself, not to its backing file). b) If the image to be mirrored lacks a backing file, the target doesn't have one either (which is not really wrong, but not really right, either; "none" records a set of operations executed on the image file, therefore having no backing file to apply these operations on seems rather pointless). For a, this is clearly a bugfix. For b, it is still a bugfix, although it might break existing API - but since that case crashed qemu just three weeks ago (before 1452686495922b81d6cf43edf025c1aef15965c0), we can safely assume there is no such API relying on that case yet. Suggested-by: Paolo Bonzini Signed-off-by: Max Reitz --- blockdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/blockdev.c b/blockdev.c index 330aa4a..44755e1 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2021,6 +2021,9 @@ void qmp_drive_mirror(const char *device, const char *target, if (!source && sync == MIRROR_SYNC_MODE_TOP) { sync = MIRROR_SYNC_MODE_FULL; } + if (sync == MIRROR_SYNC_MODE_NONE) { + source = bs; + } size = bdrv_getlength(bs); if (size < 0) { -- 1.8.4.2