[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v3 01/35] block: Formats don't need CONSISTENT_READ w
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL v3 01/35] block: Formats don't need CONSISTENT_READ with NO_IO |
Date: |
Fri, 22 Dec 2017 16:18:12 +0100 |
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 geared towards whether the guest-visible data is
consistent, and has no impact on whether the metadata is sane, and
'qemu-img info' does not read guest-visible data (except for the raw
format), it makes sense to not require BLK_PERM_CONSISTENT_READ if there
is not going to be any guest I/O performed, regardless of image format.
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block.c b/block.c
index 1c37ce4554..db0be7ef36 100644
--- a/block.c
+++ b/block.c
@@ -1924,6 +1924,8 @@ void bdrv_format_default_perms(BlockDriverState *bs,
BdrvChild *c,
assert(role == &child_backing || role == &child_file);
if (!backing) {
+ int flags = bdrv_reopen_get_flags(reopen_queue, bs);
+
/* Apart from the modifications below, the same permissions are
* forwarded and left alone as for filters */
bdrv_filter_default_perms(bs, c, role, reopen_queue, perm, shared,
@@ -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;
+ }
shared &= ~(BLK_PERM_WRITE | BLK_PERM_RESIZE);
} else {
/* We want consistent read from backing files if the parent needs it.
--
2.13.6
- [Qemu-devel] [PULL v3 00/35] Block layer patches, Kevin Wolf, 2017/12/22
- [Qemu-devel] [PULL v3 02/35] iotests: fix 197 for vpc, Kevin Wolf, 2017/12/22
- [Qemu-devel] [PULL v3 01/35] block: Formats don't need CONSISTENT_READ with NO_IO,
Kevin Wolf <=
- [Qemu-devel] [PULL v3 03/35] block: Make bdrv_drain_invoke() recursive, Kevin Wolf, 2017/12/22
- [Qemu-devel] [PULL v3 04/35] block: Call .drain_begin only once in bdrv_drain_all_begin(), Kevin Wolf, 2017/12/22
- [Qemu-devel] [PULL v3 08/35] block: Unify order in drain functions, Kevin Wolf, 2017/12/22
- [Qemu-devel] [PULL v3 05/35] test-bdrv-drain: Test BlockDriver callbacks for drain, Kevin Wolf, 2017/12/22
- [Qemu-devel] [PULL v3 07/35] block: Don't wait for requests in bdrv_drain*_end(), Kevin Wolf, 2017/12/22
- [Qemu-devel] [PULL v3 06/35] block: bdrv_drain_recurse(): Remove unused begin parameter, Kevin Wolf, 2017/12/22
- [Qemu-devel] [PULL v3 10/35] qcow2: get rid of qcow2_backing_read1 routine, Kevin Wolf, 2017/12/22
- [Qemu-devel] [PULL v3 09/35] block: Don't acquire AioContext in hmp_qemu_io(), Kevin Wolf, 2017/12/22
- [Qemu-devel] [PULL v3 13/35] block: Open backing image in force share mode for size probe, Kevin Wolf, 2017/12/22
- [Qemu-devel] [PULL v3 11/35] block: Document that x-blockdev-change breaks quorum children list, Kevin Wolf, 2017/12/22