[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/3] qcow2: Do not mark inactive images corru
From: |
Jeff Cody |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/3] qcow2: Do not mark inactive images corrupt |
Date: |
Wed, 6 Jun 2018 23:14:59 -0400 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Wed, Jun 06, 2018 at 09:37:01PM +0200, Max Reitz wrote:
> 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: address@hidden
> Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
> ---
> block/qcow2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 6b2d88759d..6fa5e1d71a 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -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)))
> --
> 2.17.0
>
- [Qemu-devel] [PATCH v2 0/3] qcow2: Do not mark inactive images corrupt, Max Reitz, 2018/06/06
- [Qemu-devel] [PATCH v2 1/3] block: Make bdrv_is_writable() public, Max Reitz, 2018/06/06
- [Qemu-devel] [PATCH v2 2/3] qcow2: Do not mark inactive images corrupt, Max Reitz, 2018/06/06
- Re: [Qemu-devel] [PATCH v2 2/3] qcow2: Do not mark inactive images corrupt,
Jeff Cody <=
- [Qemu-devel] [PATCH v2 3/3] iotests: Add case for a corrupted inactive image, Max Reitz, 2018/06/06
- Re: [Qemu-devel] [PATCH v2 0/3] qcow2: Do not mark inactive images corrupt, Max Reitz, 2018/06/06
- Re: [Qemu-devel] [PATCH v2 0/3] qcow2: Do not mark inactive images corrupt, John Snow, 2018/06/06
- Re: [Qemu-devel] [PATCH v2 0/3] qcow2: Do not mark inactive images corrupt, Max Reitz, 2018/06/09