cryptospore / rpms / qemu-kvm

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