From: Jeff Cody <jcody@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, armbru@redhat.com,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 4/4] qcow2: Check failure of bdrv_getlength()
Date: Mon, 7 Aug 2017 19:34:25 -0400 [thread overview]
Message-ID: <20170807233425.GO22129@localhost.localdomain> (raw)
In-Reply-To: <20170807203007.19033-5-eblake@redhat.com>
On Mon, Aug 07, 2017 at 03:30:07PM -0500, Eric Blake wrote:
> qcow2_co_pwritev_compressed() should not call bdrv_truncate()
> if determining the size failed.
>
> Reported-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
> ---
> block/qcow2.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 99407403ea..40ba26c111 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -3282,12 +3282,15 @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset,
> z_stream strm;
> int ret, out_len;
> uint8_t *buf, *out_buf;
> - uint64_t cluster_offset;
> + int64_t cluster_offset;
>
> if (bytes == 0) {
> /* align end of file to a sector boundary to ease reading with
> sector based I/Os */
> cluster_offset = bdrv_getlength(bs->file->bs);
> + if (cluster_offset < 0) {
> + return cluster_offset;
> + }
> return bdrv_truncate(bs->file, cluster_offset, PREALLOC_MODE_OFF, NULL);
> }
>
> --
> 2.13.4
>
>
next prev parent reply other threads:[~2017-08-07 23:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-07 20:30 [Qemu-devel] [PATCH for-2.10 0/4] More blk_getlength() fixes Eric Blake
2017-08-07 20:30 ` [Qemu-devel] [PATCH 1/4] vpc: Check failure of bdrv_getlength() Eric Blake
2017-08-07 20:43 ` Philippe Mathieu-Daudé
2017-08-07 23:32 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-08-08 8:30 ` [Qemu-devel] " Kevin Wolf
2017-08-07 20:30 ` [Qemu-devel] [PATCH 2/4] qcow: Check failure of bdrv_getlength() and bdrv_truncate() Eric Blake
2017-08-07 20:51 ` Philippe Mathieu-Daudé
2017-08-07 23:33 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-08-07 23:35 ` Jeff Cody
2017-08-08 8:28 ` [Qemu-devel] " Kevin Wolf
2017-08-08 14:16 ` Eric Blake
2017-08-07 20:30 ` [Qemu-devel] [PATCH 3/4] qcow2: Drop debugging dump_refcounts() Eric Blake
2017-08-07 20:44 ` Philippe Mathieu-Daudé
2017-08-07 23:33 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-08-08 8:32 ` [Qemu-devel] " Kevin Wolf
2017-08-07 20:30 ` [Qemu-devel] [PATCH 4/4] qcow2: Check failure of bdrv_getlength() Eric Blake
2017-08-07 20:47 ` Philippe Mathieu-Daudé
2017-08-07 23:34 ` Jeff Cody [this message]
2017-08-08 8:32 ` Kevin Wolf
2017-08-07 22:58 ` [Qemu-devel] [Qemu-block] [PATCH for-2.10 0/4] More blk_getlength() fixes John Snow
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=20170807233425.GO22129@localhost.localdomain \
--to=jcody@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@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).