qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH for-2.1] block/backup: Fix hang for unaligned image size
Date: Mon, 7 Jul 2014 17:40:31 +0200	[thread overview]
Message-ID: <20140707154031.GB4095@noname.str.redhat.com> (raw)
In-Reply-To: <53BAB601.8000803@redhat.com>

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

Am 07.07.2014 um 17:00 hat Eric Blake geschrieben:
> 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?

Yes, thanks for catching that.

> 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

I don't think there's a way yet. We'd probably have to touch the monitor
code in qemu.

Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

      reply	other threads:[~2014-07-07 15:40 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
2014-07-07 15:40   ` Kevin Wolf [this message]

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=20140707154031.GB4095@noname.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=eblake@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 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).