From: Max Reitz <mreitz@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Benoît Canet" <benoit.canet@nodalink.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 0/3] block: Fix is_allocated() for truncated images
Date: Wed, 22 Oct 2014 15:27:30 +0200 [thread overview]
Message-ID: <5447B0C2.8010204@redhat.com> (raw)
In-Reply-To: <1413984271-15471-1-git-send-email-mreitz@redhat.com>
On 2014-10-22 at 15:24, Max Reitz wrote:
> Patch 2:
> The bdrv_is_allocated() functions may return a number of zero sectors
> e.g. if a sector beyond the image end has been queried. Respect this
> case in qemu-io's map implementation so it doesn't run into an infinite
> loop (https://bugs.launchpad.net/qemu/+bug/1356969).
>
> Patch 1:
> In that bug report, bdrv_co_get_block_status() fell through to the
> underlying file to get additional information (whether the sectors are
> zeroed). However, the offset reported by the image format (qcow2) was
> beyond the size of the underlying file and so this second query returned
> only zero clusters which replaced the actual number of sectors queried
> in the "formatted" (on qcow2 level) image. This replacement is generally
> fine because it allows bdrv_co_get_block_status() to follow the
> granularity (holes and non-holes) of the underlying file, but not if
> only zero clusters could be queried (which indicates a request beyond
> the image end).
> This patch makes bdrv_co_get_block_status() respect the underlying
> file's EOF and act accordingly.
Sorry, disregard the following paragraph (which I deliberately
highlighted so it's easier to disregard).
vvv
> But because errors from this
> second call are ignored, the number of sector queried successfully
> should be ignored as well, which makes qemu-io -c map actually work for
> that bug report.
^^^
> Patch 3 adds a test for patch 1; I could not conceive a test for patch 2
> which patch 1 would not already catch, but patch 2 should be simple
> enough not to require a test anyway.
>
>
> v2:
> - In v1, patch 1 completely ignored the number of queried sectors
> returned by the recursive call; but it should only be ignored in case
> of EOF (which is indicated by returning 0 as the queried clusters
> count)
> - Thanks to fixing patch 1, the area queried in the test added in patch
> 3 is now marked unallocated (which is correct because it's beyond the
> EOF). Therefore, this test does no longer require
> _filter_qemu_img_map() (because there are no mappings shown) and this
> series no longer depends on the qemu-img/QMP commit series.
>
>
> Max Reitz (3):
> block: Respect underlying file's EOF
> qemu-io: Respect early image end for map
> iotests: Add test for map commands
>
> block.c | 16 ++++++++++--
> qemu-io-cmds.c | 5 +++-
> tests/qemu-iotests/102 | 64 ++++++++++++++++++++++++++++++++++++++++++++++
> tests/qemu-iotests/102.out | 10 ++++++++
> tests/qemu-iotests/group | 1 +
> 5 files changed, 93 insertions(+), 3 deletions(-)
> create mode 100755 tests/qemu-iotests/102
> create mode 100644 tests/qemu-iotests/102.out
>
prev parent reply other threads:[~2014-10-22 13:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-22 13:24 [Qemu-devel] [PATCH v2 0/3] block: Fix is_allocated() for truncated images Max Reitz
2014-10-22 13:24 ` [Qemu-devel] [PATCH v2 1/3] block: Respect underlying file's EOF Max Reitz
2014-10-22 13:40 ` Kevin Wolf
2014-10-22 13:42 ` Max Reitz
2014-10-22 13:24 ` [Qemu-devel] [PATCH v2 2/3] qemu-io: Respect early image end for map Max Reitz
2014-10-22 13:45 ` Kevin Wolf
2014-10-22 13:24 ` [Qemu-devel] [PATCH v2 3/3] iotests: Add test for map commands Max Reitz
2014-10-22 13:51 ` Kevin Wolf
2014-10-22 13:54 ` Max Reitz
2014-10-22 14:48 ` Max Reitz
2014-10-22 14:48 ` Max Reitz
2014-10-22 13:27 ` Max Reitz [this message]
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=5447B0C2.8010204@redhat.com \
--to=mreitz@redhat.com \
--cc=benoit.canet@nodalink.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.