All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-devel@nongnu.org
Cc: stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH for-2.1] block/backup: Fix hang for unaligned image size
Date: Mon, 07 Jul 2014 09:00:17 -0600	[thread overview]
Message-ID: <53BAB601.8000803@redhat.com> (raw)
In-Reply-To: <1404744824-8072-1-git-send-email-kwolf@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 7341 bytes --]

On 07/07/2014 08:53 AM, Kevin Wolf wrote:
> When doing a block backup of an image with an unaligned size (with
> respect to the BACKUP_CLUSTER_SIZE), qemu would check the allocation
> status of sectors after the end of the image. bdrv_is_allocated()
> returns a result that is valid for 0 sectors in this case, so the backup
> job ran into an endless loop.
> 
> Stop looping when seeing a result valid for 0 sectors, we're at EOF then.
> 
> The test case looks somewhat unrelated at first sight because I
> originally tried to reproduce a different suspected bug that turned out
> to not exist. Still a good test case and it accidentally found this one.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/backup.c             |   2 +-
>  tests/qemu-iotests/028     |  27 ++++-
>  tests/qemu-iotests/028.out | 269 +++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 296 insertions(+), 2 deletions(-)
> 
> diff --git a/block/backup.c b/block/backup.c
> index 7978ae2..d0b0225 100644
> --- a/block/backup.c
> +++ b/block/backup.c
> @@ -307,7 +307,7 @@ static void coroutine_fn backup_run(void *opaque)
>                                  BACKUP_SECTORS_PER_CLUSTER - i, &n);
>                      i += n;
>  
> -                    if (alloced == 1) {
> +                    if (alloced == 1 || n == 0) {
>                          break;
>                      }
>                  }
> diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
> index a99e4fa..864e9cc 100755
> --- a/tests/qemu-iotests/028
> +++ b/tests/qemu-iotests/028
> @@ -33,7 +33,8 @@ status=1	# failure is the default!
>  
>  _cleanup()
>  {
> -	_cleanup_test_img
> +    rm -f $TEST_IMG.copy

Doesn't this need to be "$TEST_IMG.copy", to allow for spaces in $TEST_IMG?

> +QEMU X.Y.Z monitor - type 'help' for more information
> +(qemu) d^[[K^[[Ddr^[[K^[[D^[[Ddri^[[K^[[D^[[D^[[Ddriv^[[K^[[D^[[D^[[D^[[Ddrive^[[K^[[D^[[D^[[D^[[D^[[Ddrive_^[[K^[[D^[[D^[[D^[[D^[[D^[[Ddrive_b^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_ba^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_bac^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_back^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backu^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup ^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup d^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup di^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup dis^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk ^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk /^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D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[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk /home/kwolf/source^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk /home/kwolf/source/^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk /home/kwolf/sour!
>  ce/q^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[!
>  [D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk /home/kwolf/source/qe^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk /home/kwolf/source/qem^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk /home/kwolf/source/qemu^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^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[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk /home/kwolf/source/qemu/tests^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk /home/kwolf/source/qemu/tests/^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk /home/kwolf/source/qemu/tests/q^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[!
>  D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Ddrive_backup disk /home/kwol!

Is there any way to avoid super-long-lines like this in the testsuite?
But that's a generic complaint, and doesn't affect the correctness of
this patch.

With the quotes added,
Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-07-07 15:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07 14:53 [Qemu-devel] [PATCH for-2.1] block/backup: Fix hang for unaligned image size Kevin Wolf
2014-07-07 15:00 ` Eric Blake [this message]
2014-07-07 15:40   ` Kevin Wolf

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=53BAB601.8000803@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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.