On 11/30/2017 10:44 AM, Kevin Wolf wrote:
Commit 1f4ad7d fixed 'qemu-img info' for raw images that are currently
in use as a mirror target. It is not enough for image formats, though,
as these still unconditionally request BLK_PERM_CONSISTENT_READ.
As this permission is meaningless unless you do actual I/O on the image,
drop the requirement and allow 'qemu-img info' even for image formats
under conditions where BLK_PERM_CONSISTENT_READ can't be granted.
Signed-off-by: Kevin Wolf <kw...@redhat.com>
---
block.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
@@ -1936,7 +1938,9 @@ void bdrv_format_default_perms(BlockDriverState *bs,
BdrvChild *c,
/* bs->file always needs to be consistent because of the metadata. We
* can never allow other users to resize or write to it. */
- perm |= BLK_PERM_CONSISTENT_READ;
+ if (!(flags & BDRV_O_NO_IO)) {
+ perm |= BLK_PERM_CONSISTENT_READ;
I thought BDRV_O_NO_IO only means we aren't doing I/O on guest-visible
data, but doesn't stop us from reading the metadata. The comment is
telling: if we can read metadata, then we depend on CONSISTENT_READ for
the metadata to be stable (even if we don't care about guest data
consistency).
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org