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

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