From: Cole Robinson <crobinso@redhat.com>
To: "Jindřich Makovička" <makovick@gmail.com>, qemu-devel@nongnu.org
Cc: "Richard W.M. Jones" <rjones@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qcow2: Handle EAGAIN returned from update_refcount
Date: Wed, 24 Jun 2015 10:15:21 -0400 [thread overview]
Message-ID: <558ABB79.20202@redhat.com> (raw)
In-Reply-To: <1435122325-13478-1-git-send-email-makovick@gmail.com>
On 06/24/2015 01:05 AM, Jindřich Makovička wrote:
> Fixes a crash during image compression
>
> Signed-off-by: Jindřich Makovička <makovick@gmail.com>
> ---
> block/qcow2-refcount.c | 22 ++++++++++++----------
> 1 file changed, 12 insertions(+), 10 deletions(-)
>
Rich Jones already confirmed that this patch fixes a bug he can reliably
reproduce:
https://bugzilla.redhat.com/show_bug.cgi?id=1214855
- Cole
> diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
> index 0632fc3..b0ee42d 100644
> --- a/block/qcow2-refcount.c
> +++ b/block/qcow2-refcount.c
> @@ -940,19 +940,21 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size)
> }
>
> free_in_cluster = s->cluster_size - offset_into_cluster(s, offset);
> - if (!offset || free_in_cluster < size) {
> - int64_t new_cluster = alloc_clusters_noref(bs, s->cluster_size);
> - if (new_cluster < 0) {
> - return new_cluster;
> - }
> + do {
> + if (!offset || free_in_cluster < size) {
> + int64_t new_cluster = alloc_clusters_noref(bs, s->cluster_size);
> + if (new_cluster < 0) {
> + return new_cluster;
> + }
>
> - if (!offset || ROUND_UP(offset, s->cluster_size) != new_cluster) {
> - offset = new_cluster;
> + if (!offset || ROUND_UP(offset, s->cluster_size) != new_cluster) {
> + offset = new_cluster;
> + }
> }
> - }
>
> - assert(offset);
> - ret = update_refcount(bs, offset, size, 1, false, QCOW2_DISCARD_NEVER);
> + assert(offset);
> + ret = update_refcount(bs, offset, size, 1, false, QCOW2_DISCARD_NEVER);
> + } while (ret == -EAGAIN);
> if (ret < 0) {
> return ret;
> }
>
next prev parent reply other threads:[~2015-06-24 14:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-23 21:34 [Qemu-devel] [PATCH] Fix occassional crashes during qcow2 recompression Jindřich Makovička
2015-06-23 21:34 ` [Qemu-devel] [PATCH] qcow2: Handle EAGAIN returned from update_refcount Jindřich Makovička
2015-06-24 5:05 ` Jindřich Makovička
2015-06-24 14:15 ` Cole Robinson [this message]
2015-06-24 14:22 ` Richard W.M. Jones
2015-06-24 15:26 ` Max Reitz
2015-06-25 14:52 ` [Qemu-devel] [PATCH] Fix occassional crashes during qcow2 recompression Stefan Hajnoczi
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=558ABB79.20202@redhat.com \
--to=crobinso@redhat.com \
--cc=makovick@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.