qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <famz@redhat.com>,
	Wenchao Xia <xiawenc@linux.vnet.ibm.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 1/2] block/drive-mirror: Check for NULL backing_hd
Date: Wed, 06 Nov 2013 12:01:45 -0700	[thread overview]
Message-ID: <527A9219.40108@redhat.com> (raw)
In-Reply-To: <1383763845-30340-2-git-send-email-mreitz@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]

On 11/06/2013 11:50 AM, Max Reitz wrote:
> 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").
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  blockdev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/blockdev.c b/blockdev.c
> index b260477..1c426b0 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -2026,7 +2026,9 @@ void qmp_drive_mirror(const char *device, const char *target,
>          return;
>      }
>  
> -    if (sync == MIRROR_SYNC_MODE_FULL && mode != NEW_IMAGE_MODE_EXISTING) {
> +    if ((sync == MIRROR_SYNC_MODE_FULL || !source)
> +        && mode != NEW_IMAGE_MODE_EXISTING)
> +    {
>          /* create new image w/o backing file */
>          assert(format && drv);
>          bdrv_img_create(target, format,
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

  reply	other threads:[~2013-11-06 19:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 18:50 [Qemu-devel] [PATCH v3 0/2] block/drive-mirror: Check for NULL backing_hd Max Reitz
2013-11-06 18:50 ` [Qemu-devel] [PATCH v3 1/2] " Max Reitz
2013-11-06 19:01   ` Eric Blake [this message]
2013-11-06 18:50 ` [Qemu-devel] [PATCH v3 2/2] qemu-iotests: Extend 041 for unbacked mirroring Max Reitz
2013-11-07  9:51   ` Paolo Bonzini
2013-11-07  2:25 ` [Qemu-devel] [PATCH v3 0/2] block/drive-mirror: Check for NULL backing_hd Wenchao Xia
2013-11-07  9:11   ` Max Reitz
2013-11-11 16:05 ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=527A9219.40108@redhat.com \
    --to=eblake@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=xiawenc@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).