|
|
9bac43 |
From a80280654277c361714ec5f3925d2d6b077eca7b Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
9bac43 |
Date: Mon, 15 Jan 2018 11:23:37 +0100
|
|
|
9bac43 |
Subject: [PATCH 12/12] block: Formats don't need CONSISTENT_READ with NO_IO
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
9bac43 |
Message-id: <20180115112337.20885-4-kwolf@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 78574
|
|
|
9bac43 |
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH 3/3] block: Formats don't need CONSISTENT_READ with NO_IO
|
|
|
9bac43 |
Bugzilla: 1515604
|
|
|
9bac43 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
Commit 1f4ad7d fixed 'qemu-img info' for raw images that are currently
|
|
|
9bac43 |
in use as a mirror target. It is not enough for image formats, though,
|
|
|
9bac43 |
as these still unconditionally request BLK_PERM_CONSISTENT_READ.
|
|
|
9bac43 |
|
|
|
9bac43 |
As this permission is geared towards whether the guest-visible data is
|
|
|
9bac43 |
consistent, and has no impact on whether the metadata is sane, and
|
|
|
9bac43 |
'qemu-img info' does not read guest-visible data (except for the raw
|
|
|
9bac43 |
format), it makes sense to not require BLK_PERM_CONSISTENT_READ if there
|
|
|
9bac43 |
is not going to be any guest I/O performed, regardless of image format.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9bac43 |
(cherry picked from commit 5fbfabd313b77e1cc7038ae8c4481c4b9f8b650a)
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
block.c | 6 +++++-
|
|
|
9bac43 |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/block.c b/block.c
|
|
|
9bac43 |
index 90a60bc..ca8a46b 100644
|
|
|
9bac43 |
--- a/block.c
|
|
|
9bac43 |
+++ b/block.c
|
|
|
9bac43 |
@@ -1885,6 +1885,8 @@ void bdrv_format_default_perms(BlockDriverState *bs, BdrvChild *c,
|
|
|
9bac43 |
assert(role == &child_backing || role == &child_file);
|
|
|
9bac43 |
|
|
|
9bac43 |
if (!backing) {
|
|
|
9bac43 |
+ int flags = bdrv_reopen_get_flags(reopen_queue, bs);
|
|
|
9bac43 |
+
|
|
|
9bac43 |
/* Apart from the modifications below, the same permissions are
|
|
|
9bac43 |
* forwarded and left alone as for filters */
|
|
|
9bac43 |
bdrv_filter_default_perms(bs, c, role, reopen_queue, perm, shared,
|
|
|
9bac43 |
@@ -1897,7 +1899,9 @@ void bdrv_format_default_perms(BlockDriverState *bs, BdrvChild *c,
|
|
|
9bac43 |
|
|
|
9bac43 |
/* bs->file always needs to be consistent because of the metadata. We
|
|
|
9bac43 |
* can never allow other users to resize or write to it. */
|
|
|
9bac43 |
- perm |= BLK_PERM_CONSISTENT_READ;
|
|
|
9bac43 |
+ if (!(flags & BDRV_O_NO_IO)) {
|
|
|
9bac43 |
+ perm |= BLK_PERM_CONSISTENT_READ;
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
shared &= ~(BLK_PERM_WRITE | BLK_PERM_RESIZE);
|
|
|
9bac43 |
} else {
|
|
|
9bac43 |
/* We want consistent read from backing files if the parent needs it.
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|