From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeFHu-000592-VA for qemu-devel@nongnu.org; Wed, 06 Nov 2013 21:25:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeFHm-0003OG-0h for qemu-devel@nongnu.org; Wed, 06 Nov 2013 21:25:38 -0500 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:36998) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeFHk-0003Np-Ni for qemu-devel@nongnu.org; Wed, 06 Nov 2013 21:25:29 -0500 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 7 Nov 2013 12:25:09 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 494673578056 for ; Thu, 7 Nov 2013 13:25:07 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rA727Zm347972574 for ; Thu, 7 Nov 2013 13:07:36 +1100 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rA72P6cC029336 for ; Thu, 7 Nov 2013 13:25:06 +1100 Message-ID: <527AFA03.8040402@linux.vnet.ibm.com> Date: Thu, 07 Nov 2013 10:25:07 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1383763845-30340-1-git-send-email-mreitz@redhat.com> In-Reply-To: <1383763845-30340-1-git-send-email-mreitz@redhat.com> Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v3 0/2] block/drive-mirror: Check for NULL backing_hd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Fam Zheng , Stefan Hajnoczi ÓÚ 2013/11/7 2:50, Max Reitz дµÀ: > It should be possible to execute the QMP "drive-mirror" command in > "none" sync mode and "absolute-paths" mode even for block devices > lacking a backing file. > > "absolute-paths" does in fact not require a backing file to be present, > as can be seen from the "top" sync mode code path. "top" basically > states that the device should indeed have a backing file - however, the > current code catches the case if it doesn't and then simply treats it as > "full" sync mode, creating a target image without a backing file (in > "absolute-paths" mode). Thus, "absolute-paths" does not imply the target > file must indeed have a backing file. > > Therefore, the target file may be left unbacked in case of "none" sync > mode as well, if the specified device is not backed either. Currently, > qemu will crash trying to dereference the backing file pointer since it > assumes that it will always be non-NULL in that case ("none" with > "absolute-paths"). > > The first patch in this series adds a check whether the specified block > device is backed or not (creating an unbacked target image, if required); > the second patch adds a test case for mirroring unbacked block devices. > > v2: > - patch 1: Reuse an already existing codepath to create an unbacked > target image instead of introducing a new one (based on > Fam's comment). > - patch 2: Incorporated test case into 041 instead of creating a new > file (according to Xia's and Paolo's comments). > > > Max Reitz (2): > block/drive-mirror: Check for NULL backing_hd > qemu-iotests: Extend 041 for unbacked mirroring > > blockdev.c | 4 +++- > tests/qemu-iotests/041 | 25 +++++++++++++++++++++++++ > tests/qemu-iotests/041.out | 4 ++-- > 3 files changed, 30 insertions(+), 3 deletions(-) > Reviewed-by: Wenchao Xia Should we change doc for NewImageMode in qapi-schema.json also?