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

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