From: Jeff Cody <jcody@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
qemu-stable@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 1/2] qcow2: Do not mark inactive images corrupt
Date: Mon, 4 Jun 2018 16:06:11 -0400 [thread overview]
Message-ID: <20180604200611.GA14298@localhost.localdomain> (raw)
In-Reply-To: <20180604141437.22758-2-mreitz@redhat.com>
On Mon, Jun 04, 2018 at 04:14:36PM +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.
>
> (Otherwise, the assert(!(bs->open_flags & BDRV_O_INACTIVE)) in
> bdrv_co_pwritev() will fail, crashing qemu.)
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> block/qcow2.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 59a38b9cd3..8b5f7386f7 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -4402,7 +4402,9 @@ void qcow2_signal_corruption(BlockDriverState *bs, bool fatal, int64_t offset,
> char *message;
> va_list ap;
>
> - fatal = fatal && !bs->read_only;
> + if ((bs->open_flags & (BDRV_O_RDWR | BDRV_O_INACTIVE)) != BDRV_O_RDWR) {
Hmm, this is pretty much exactly what the bdrv_is_writable() helper function
does in block.c; too bad it's scope is limited to block.c. Maybe worth it
to make it a more widely available helper and use it here?
> + fatal = false;
> + }
>
> if (s->signaled_corruption &&
> (!fatal || (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT)))
> --
> 2.17.0
>
>
next prev parent reply other threads:[~2018-06-04 20:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 14:14 [Qemu-devel] [PATCH 0/2] qcow2: Do not mark inactive images corrupt Max Reitz
2018-06-04 14:14 ` [Qemu-devel] [PATCH 1/2] " Max Reitz
2018-06-04 20:06 ` Jeff Cody [this message]
2018-06-06 10:22 ` [Qemu-devel] [Qemu-block] " Max Reitz
2018-06-04 14:14 ` [Qemu-devel] [PATCH 2/2] iotests: Add case for a corrupted inactive image Max Reitz
2018-06-04 20:10 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-06-04 18:58 ` [Qemu-devel] [Qemu-block] [PATCH 0/2] qcow2: Do not mark inactive images corrupt John Snow
2018-06-06 19:32 ` Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180604200611.GA14298@localhost.localdomain \
--to=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).