qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
	Fam Zheng <famz@redhat.com>,
	nsoffer@redhat.com, eblake@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 2/3] block/mirror: Fix target backing BDS
Date: Wed, 8 Jun 2016 16:40:14 +0200	[thread overview]
Message-ID: <c360b96d-6f15-c07e-c30e-d4b732ef51a4@redhat.com> (raw)
In-Reply-To: <666270289.20792192.1465385289909.JavaMail.zimbra@redhat.com>

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

On 08.06.2016 13:28, Paolo Bonzini wrote:
> 
> 
> ----- Original Message -----
>> From: "Kevin Wolf" <kwolf@redhat.com>
>> To: "Max Reitz" <mreitz@redhat.com>
>> Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, "Fam Zheng" <famz@redhat.com>, nsoffer@redhat.com,
>> eblake@redhat.com, pbonzini@redhat.com
>> Sent: Wednesday, June 8, 2016 11:32:29 AM
>> Subject: Re: [PATCH v2 2/3] block/mirror: Fix target backing BDS
>>
>> Am 06.06.2016 um 16:42 hat Max Reitz geschrieben:
>>> Currently, we are trying to move the backing BDS from the source to the
>>> target in bdrv_replace_in_backing_chain() which is called from
>>> mirror_exit(). However, mirror_complete() already tries to open the
>>> target's backing chain with a call to bdrv_open_backing_file().
>>>
>>> First, we should only set the target's backing BDS once. Second, the
>>> mirroring block job has a better idea of what to set it to than the
>>> generic code in bdrv_replace_in_backing_chain() (in fact, the latter's
>>> conditions on when to move the backing BDS from source to target are not
>>> really correct).
>>>
>>> Therefore, remove that code from bdrv_replace_in_backing_chain() and
>>> leave it to mirror_complete().
>>>
>>> However, mirror_complete() in turn pursues a questionable strategy by
>>> employing bdrv_open_backing_file(): On the one hand, because this may
>>> open the wrong backing file with drive-mirror in "existing" mode, or
>>> because it will not override a possibly wrong backing file in the
>>> blockdev-mirror case.
>>
>> Careful, this "wrong" backing file might actually be intended!
>>
>> Consider a case where you want to move an image with its whole backing
>> chain to different storage. In that case, you would copy all of the
>> backing files (cp is good enough, they are read-only), create the
>> destination image which already points at the copied backing chain, and
>> then mirror in "existing" mode.
>>
>> The intention is obviously that after the job completion the new backing
>> chain is used and not the old one.
> 
> Yes, this is the intention and it should not be changed.  In addition
> to what Kevin said, you can use drive-mirror to collapse the image to a
> single file; in this case, QEMU should not be using the backing files of
> the source.

That is an issue that we have right now. If you do drive-mirror in
absolute-paths mode with sync=full, the target will have the backing
chain of the source. This is something that this patch fixes.

In fact, I think if you do drive-mirror in existing mode or
blockdev-mirror and the target image does not have a backing file
(whatever sync mode you have used), the same will happen.

Max

> bdrv_open_backing_file() is used because what we want to do is to
> "undo" the BDRV_O_NO_BACKING flag used by qmp_drive_mirror.
> 
> If the contents change under the guest feet, it's the layers above
> QEMU that have screwed up.
> 
> Paolo
> 



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

  parent reply	other threads:[~2016-06-08 14:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 14:42 [Qemu-devel] [PATCH v2 0/3] block/mirror: Fix target backing BDS Max Reitz
2016-06-06 14:42 ` [Qemu-devel] [PATCH v2 1/3] block: Allow replacement of a BDS by its overlay Max Reitz
2016-06-08  8:58   ` Kevin Wolf
2016-06-08 14:21     ` Max Reitz
2016-06-06 14:42 ` [Qemu-devel] [PATCH v2 2/3] block/mirror: Fix target backing BDS Max Reitz
2016-06-08  9:32   ` Kevin Wolf
2016-06-08 11:28     ` Paolo Bonzini
2016-06-08 11:47       ` Kevin Wolf
2016-06-08 14:40       ` Max Reitz [this message]
2016-06-08 14:42         ` Max Reitz
2016-06-08 14:38     ` Max Reitz
2016-06-08 16:54       ` Max Reitz
2016-06-08 15:39     ` Nir Soffer
2016-06-09  8:58       ` Kevin Wolf
2016-06-09 11:16         ` Nir Soffer
2016-06-06 14:42 ` [Qemu-devel] [PATCH v2 3/3] iotests: Add test for post-mirror backing chains Max Reitz

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=c360b96d-6f15-c07e-c30e-d4b732ef51a4@redhat.com \
    --to=mreitz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=nsoffer@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).