qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-2.1] block/backup: Fix hang for unaligned im


From: Kevin Wolf
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
User-agent: Mutt/1.5.21 (2010-09-15)

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 <address@hidden>
> > ---
> >  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: pgp16D8bHYR0V.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]