From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com, qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qcow2: make is_allocated return true for zero clusters
Date: Wed, 13 Mar 2013 10:14:23 +0100 [thread overview]
Message-ID: <20130313091423.GA2309@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <1362589321-21402-1-git-send-email-pbonzini@redhat.com>
Am 06.03.2013 um 18:02 hat Paolo Bonzini geschrieben:
> Otherwise, live migration of the top layer will miss zero clusters and
> let the backing file show through. This also matches what is done in qed.
>
> QCOW2_CLUSTER_ZERO clusters are invalid in v2 image files. Check this
> directly in qcow2_get_cluster_offset instead of replicating the test
> everywhere.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Can you add a test case for this?
Also is_allocated() probably is the wrong interface now because it can
mean different things. The content of a zero cluster is indeed defined
by the image, but it may or may not be fully allocated yet. Have you
checked if the callers use it consistently in the former way?
> block/qcow2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
> index 56fccf9..bb04432 100644
> --- a/block/qcow2-cluster.c
> +++ b/block/qcow2-cluster.c
> @@ -454,6 +454,9 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset,
> *cluster_offset &= L2E_COMPRESSED_OFFSET_SIZE_MASK;
> break;
> case QCOW2_CLUSTER_ZERO:
> + if (s->qcow_version < 3) {
> + return -EIO;
> + }
This leaks a cache entry.
Kevin
next prev parent reply other threads:[~2013-03-13 9:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 17:02 [Qemu-devel] [PATCH] qcow2: make is_allocated return true for zero clusters Paolo Bonzini
2013-03-08 10:54 ` Stefan Hajnoczi
2013-03-11 14:10 ` Stefan Hajnoczi
2013-03-13 9:14 ` Kevin Wolf [this message]
2013-03-13 10:10 ` Paolo Bonzini
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=20130313091423.GA2309@dhcp-200-207.str.redhat.com \
--to=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=stefanha@redhat.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).