Blame SOURCES/kvm-qcow2-Do-not-mark-inactive-images-corrupt.patch

1bdc94
From f853102082f547314221cdd5846493252826086f Mon Sep 17 00:00:00 2001
1bdc94
From: Max Reitz <mreitz@redhat.com>
1bdc94
Date: Mon, 18 Jun 2018 18:00:54 +0200
1bdc94
Subject: [PATCH 48/54] qcow2: Do not mark inactive images corrupt
1bdc94
1bdc94
RH-Author: Max Reitz <mreitz@redhat.com>
1bdc94
Message-id: <20180618180055.22739-3-mreitz@redhat.com>
1bdc94
Patchwork-id: 80793
1bdc94
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 2/3] qcow2: Do not mark inactive images corrupt
1bdc94
Bugzilla: 1588039
1bdc94
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
1bdc94
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
RH-Acked-by: John Snow <jsnow@redhat.com>
1bdc94
1bdc94
When signaling a corruption on a read-only image, qcow2 already makes
1bdc94
fatal events non-fatal (i.e., they will not result in the image being
1bdc94
closed, and the image header's corrupt flag will not be set).  This is
1bdc94
necessary because we cannot set the corrupt flag on read-only images,
1bdc94
and it is possible because further corruption of read-only images is
1bdc94
impossible.
1bdc94
1bdc94
Inactive images are effectively read-only, too, so we should do the same
1bdc94
for them.  bdrv_is_writable() can tell us whether an image can actually
1bdc94
be written to, so use its result instead of !bs->read_only.
1bdc94
1bdc94
(Otherwise, the assert(!(bs->open_flags & BDRV_O_INACTIVE)) in
1bdc94
bdrv_co_pwritev() will fail, crashing qemu.)
1bdc94
1bdc94
Cc: qemu-stable@nongnu.org
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
Message-id: 20180606193702.7113-3-mreitz@redhat.com
1bdc94
Reviewed-by: John Snow <jsnow@redhat.com>
1bdc94
Reviewed-by: Jeff Cody <jcody@redhat.com>
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
(cherry picked from commit ddf3b47ef4b5ed0bf6558d4c2c8ae130b8d8a580)
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 block/qcow2.c | 2 +-
1bdc94
 1 file changed, 1 insertion(+), 1 deletion(-)
1bdc94
1bdc94
diff --git a/block/qcow2.c b/block/qcow2.c
1bdc94
index 35842c5..26a6a7f 100644
1bdc94
--- a/block/qcow2.c
1bdc94
+++ b/block/qcow2.c
1bdc94
@@ -4383,7 +4383,7 @@ void qcow2_signal_corruption(BlockDriverState *bs, bool fatal, int64_t offset,
1bdc94
     char *message;
1bdc94
     va_list ap;
1bdc94
 
1bdc94
-    fatal = fatal && !bs->read_only;
1bdc94
+    fatal = fatal && bdrv_is_writable(bs);
1bdc94
 
1bdc94
     if (s->signaled_corruption &&
1bdc94
         (!fatal || (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT)))
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94