Blame SOURCES/kvm-block-Don-t-use-BLK_PERM_CONSISTENT_READ-for-format-.patch

9bac43
From ab2ef6c7b0c99840a5b530899076998a7bbdf5df Mon Sep 17 00:00:00 2001
9bac43
From: Kevin Wolf <kwolf@redhat.com>
9bac43
Date: Mon, 15 Jan 2018 11:23:35 +0100
9bac43
Subject: [PATCH 10/12] block: Don't use BLK_PERM_CONSISTENT_READ for format
9bac43
 probing
9bac43
9bac43
RH-Author: Kevin Wolf <kwolf@redhat.com>
9bac43
Message-id: <20180115112337.20885-2-kwolf@redhat.com>
9bac43
Patchwork-id: 78573
9bac43
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH 1/3] block: Don't use BLK_PERM_CONSISTENT_READ for format probing
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
For format probing, we don't really care whether all of the image
9bac43
content is consistent. The only thing we're looking at is the image
9bac43
header, and specifically the magic numbers that are expected to never
9bac43
change, no matter how inconsistent the guest visible disk content is.
9bac43
9bac43
Therefore, don't request BLK_PERM_CONSISTENT_READ. This allows to use
9bac43
format probing, e.g. in the context of 'qemu-img info', even while the
9bac43
guest visible data in the image is inconsistent during a running block
9bac43
job.
9bac43
9bac43
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9bac43
Reviewed-by: Fam Zheng <famz@redhat.com>
9bac43
(cherry picked from commit dacaa16238cc5915a609ddaab4b7f81c4bceb9ae)
9bac43
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 block.c | 5 ++++-
9bac43
 1 file changed, 4 insertions(+), 1 deletion(-)
9bac43
9bac43
diff --git a/block.c b/block.c
9bac43
index 17629ab..90a60bc 100644
9bac43
--- a/block.c
9bac43
+++ b/block.c
9bac43
@@ -2540,7 +2540,10 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
9bac43
             goto fail;
9bac43
         }
9bac43
         if (file_bs != NULL) {
9bac43
-            file = blk_new(BLK_PERM_CONSISTENT_READ, BLK_PERM_ALL);
9bac43
+            /* Not requesting BLK_PERM_CONSISTENT_READ because we're only
9bac43
+             * looking at the header to guess the image format. This works even
9bac43
+             * in cases where a guest would not see a consistent state. */
9bac43
+            file = blk_new(0, BLK_PERM_ALL);
9bac43
             blk_insert_bs(file, file_bs, &local_err);
9bac43
             bdrv_unref(file_bs);
9bac43
             if (local_err) {
9bac43
-- 
9bac43
1.8.3.1
9bac43