Received: from eggs.gnu.org ([2001:4830:134:3::10]:54605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4B22-0003h6-C6 for qemu-devel@nongnu.org; Mon, 07 Jul 2014 11:40:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4B1u-00080b-92 for qemu-devel@nongnu.org; Mon, 07 Jul 2014 11:40:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4B1t-00080R-TA for qemu-devel@nongnu.org; Mon, 07 Jul 2014 11:40:34 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s67FeXIS018626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 7 Jul 2014 11:40:33 -0400 Date: Mon, 7 Jul 2014 17:40:31 +0200 From: Kevin Wolf Message-ID: <20140707154031.GB4095@noname.str.redhat.com> References: <1404744824-8072-1-git-send-email-kwolf@redhat.com> <53BAB601.8000803@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vkogqOf2sHV7VnPd" Content-Disposition: inline In-Reply-To: <53BAB601.8000803@redhat.com> Subject: Re: [Qemu-devel] [PATCH for-2.1] block/backup: Fix hang for unaligned image size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, stefanha@redhat.com --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. > >=20 > > Stop looping when seeing a result valid for 0 sectors, we're at EOF the= n. > >=20 > > 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. > >=20 > > Signed-off-by: Kevin Wolf > > --- > > block/backup.c | 2 +- > > tests/qemu-iotests/028 | 27 ++++- > > tests/qemu-iotests/028.out | 269 +++++++++++++++++++++++++++++++++++++= ++++++++ > > 3 files changed, 296 insertions(+), 2 deletions(-) > >=20 > > 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 +=3D n; > > =20 > > - if (alloced =3D=3D 1) { > > + if (alloced =3D=3D 1 || n =3D=3D 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=3D1 # failure is the default! > > =20 > > _cleanup() > > { > > - _cleanup_test_img > > + rm -f $TEST_IMG.copy >=20 > Doesn't this need to be "$TEST_IMG.copy", to allow for spaces in $TEST_IM= G? 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 --vkogqOf2sHV7VnPd Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJTur9vAAoJEH8JsnLIjy/WolwQALAICaY1JsE14krEO0kP25Fk HAvzHGSFHL0ZCKRtF5dNqynFOkmriem2QzWbD0F/WLYbXQaNvH+nrhJru8GJWDVA lZnYojlhPkwOOsGLfIUld3HPjAROp59ao1vz5LMZBMBUaY4hAgvm2uXJcuySG8Ni r1K6a9SpDu0Bh5V3epMkW/BAO972drtNlNPldg60kvn3QrUGODJeCVklwzWPzWSk CwfnLSoK4mlBUxFK3FZbSOkUNwN13oRV2rPrchOn17iyyVMIM39ji4BaiYVC3HXg OX5mXGGKQIR/K9YZgGv8mFHamE1S0LwnJcng3jec+XSB5LaniXJth1tPmsBH6peA ntv9o6rK+/jmFn1KbovMol0ZExrK9PAPsdXGndbBKV64oGPZzrPMaeh/KkqI10KG seaSW1j9DWyECHt5R4RNDXdVCWiM4Oqrp+5Y4d6SHbL9KYe3jCHNi94cswMBjxuc igEk26N1Q0sRG5mKzewcj79vaVwrqjiZ6oUH/N7GbR7naWOsy7PPhdChnCuat5g7 qrP9OdIayTW5rpuIsOPr2sCt9HH+a/AQA8aO8UAt1o8TXA2ACHyBxAIsorXUtGQ5 lRF9hCRZSUaFM/zIcpR2ADsqM3hjjFPgPrdx3YnSSSEMqNsNtn6wGRcMirg2DVkb LuLfY/l8fhtjvd9UiBNt =lcvD -----END PGP SIGNATURE----- --vkogqOf2sHV7VnPd--