]> Git Repo - qemu.git/commitdiff
qcow2: Do not mark inactive images corrupt
authorMax Reitz <[email protected]>
Wed, 6 Jun 2018 19:37:01 +0000 (21:37 +0200)
committerMax Reitz <[email protected]>
Mon, 11 Jun 2018 14:18:45 +0000 (16:18 +0200)
When signaling a corruption on a read-only image, qcow2 already makes
fatal events non-fatal (i.e., they will not result in the image being
closed, and the image header's corrupt flag will not be set).  This is
necessary because we cannot set the corrupt flag on read-only images,
and it is possible because further corruption of read-only images is
impossible.

Inactive images are effectively read-only, too, so we should do the same
for them.  bdrv_is_writable() can tell us whether an image can actually
be written to, so use its result instead of !bs->read_only.

(Otherwise, the assert(!(bs->open_flags & BDRV_O_INACTIVE)) in
bdrv_co_pwritev() will fail, crashing qemu.)

Cc: [email protected]
Signed-off-by: Max Reitz <[email protected]>
Message-id: 20180606193702[email protected]
Reviewed-by: John Snow <[email protected]>
Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
block/qcow2.c

index 6b2d88759d22b7ae2178f82df29dc81fb10c37f3..6fa5e1d71a93b7d4c233bbd84b81e9446b64b185 100644 (file)
@@ -4569,7 +4569,7 @@ void qcow2_signal_corruption(BlockDriverState *bs, bool fatal, int64_t offset,
     char *message;
     va_list ap;
 
-    fatal = fatal && !bs->read_only;
+    fatal = fatal && bdrv_is_writable(bs);
 
     if (s->signaled_corruption &&
         (!fatal || (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT)))
This page took 0.031067 seconds and 4 git commands to generate.