From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, asias@redhat.com, famz@redhat.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] vmdk: fix cluster size check for flat extents
Date: Wed, 18 Sep 2013 19:14:15 +0800 [thread overview]
Message-ID: <1379502855-27759-3-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1379502855-27759-1-git-send-email-famz@redhat.com>
We use the extent size as cluster size for flat extents (where no L1/L2
table is allocated so it's safe).
So don't check the cluster size for flat case in opening.
Otherwise flat extent opening is broken:
# qemu-img create -f vmdk -o subformat=monolithicFlat /tmp/a.vmdk 100G
Formatting '/tmp/a.vmdk', fmt=vmdk size=107374182400 compat6=off subformat='monolithicFlat' zeroed_grain=off
# qemu-img info /tmp/a.vmdk
image: /tmp/a.vmdk
file format: raw
virtual size: 0 (0 bytes)
disk size: 4.0K
Signed-off-by: Fam Zheng <famz@redhat.com>
---
block/vmdk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index fb5b529..fdd4eaa 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -396,7 +396,7 @@ static int vmdk_add_extent(BlockDriverState *bs,
VmdkExtent *extent;
BDRVVmdkState *s = bs->opaque;
- if (cluster_sectors > 0x200000) {
+ if (!flat && cluster_sectors > 0x200000) {
/* 0x200000 * 512Bytes = 1GB for one cluster is unrealistic */
error_report("invalid granularity, image may be corrupt");
return -EINVAL;
--
1.8.3.1
next prev parent reply other threads:[~2013-09-18 11:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-18 11:14 [Qemu-devel] [PATCH 0/2] block: two fixes for image opening Fam Zheng
2013-09-18 11:14 ` [Qemu-devel] [PATCH 1/2] block: don't lose data from last incomplete sector Fam Zheng
2013-09-20 14:41 ` Stefan Hajnoczi
2013-09-18 11:14 ` Fam Zheng [this message]
2013-09-19 11:31 ` [Qemu-devel] [PATCH 2/2] vmdk: fix cluster size check for flat extents Stefan Hajnoczi
2013-09-20 15:04 ` Paolo Bonzini
2013-09-22 0:53 ` Fam Zheng
2013-09-19 11:31 ` [Qemu-devel] [PATCH 0/2] block: two fixes for image opening Stefan Hajnoczi
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=1379502855-27759-3-git-send-email-famz@redhat.com \
--to=famz@redhat.com \
--cc=asias@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@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).