From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5Ne4-00055x-2o for qemu-devel@nongnu.org; Fri, 02 Aug 2013 18:16:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5Ndy-0000za-Ij for qemu-devel@nongnu.org; Fri, 02 Aug 2013 18:16:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5Ndy-0000z1-9a for qemu-devel@nongnu.org; Fri, 02 Aug 2013 18:16:18 -0400 Message-ID: <51FC2FAD.3020402@redhat.com> Date: Fri, 02 Aug 2013 16:16:13 -0600 From: Eric Blake MIME-Version: 1.0 References: <1375434137-4452-1-git-send-email-gesaint@linux.vnet.ibm.com> <1375434137-4452-3-git-send-email-gesaint@linux.vnet.ibm.com> In-Reply-To: <1375434137-4452-3-git-send-email-gesaint@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fL55ljUBDNxRX79wsmtuiwMCJliOpWotw" Subject: Re: [Qemu-devel] [PATCH V5 2/6] qemu-img: Add infinite loop checking in bdrv_new_open() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Xu Wang Cc: kwolf@redhat.com, famz@redhat.com, stefanha@gmail.com, qemu-devel@nongnu.org, wdongxu@linux.vnet.ibm.com, Xu Wang , xiawenc@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --fL55ljUBDNxRX79wsmtuiwMCJliOpWotw Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/02/2013 03:02 AM, Xu Wang wrote: > From: Xu Wang >=20 > Every image should be checked if there is infinite loop in backing > file chain before open it. So infinite loop check was added into > bdrv_new_open(). If @filename is opened with no flags s/with no flags/without the flag/ > BDRV_O_NO_BACKING, the infinite loop check should be called. >=20 > Signed-off-by: Xu Wang > --- > qemu-img.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/qemu-img.c b/qemu-img.c > index 4f01b0a..1a63bbf 100644 > --- a/qemu-img.c > +++ b/qemu-img.c > @@ -278,6 +278,13 @@ static BlockDriverState *bdrv_new_open(const char = *filename, > drv =3D NULL; > } > =20 > + /* check backing file loop if the whole chain need to be opened */= > + if (!(flags & BDRV_O_NO_BACKING) && > + bdrv_backing_file_loop_check(filename, fmt, NULL, NULL)) { > + error_report("bdrv_new_open: Open %s failed.", filename); Error messages generally don't end with '.'; also, this message seems to lack details that might be useful to the end user (we know that either the backing chain couldn't be completely followed or has a loop). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --fL55ljUBDNxRX79wsmtuiwMCJliOpWotw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJR/C+tAAoJEKeha0olJ0Nq0R0H/ivgBAgt9vaMavKOjqFK2doZ /pwt2cOofJE9zZOqZuW266n8E9tsR9QuEoc6IhFLL6/FER136NNADzPuBQNmUS0j 3U5a7Nf2w2b9RqSI/pZjQOk1IGoWnVD1JXyi+L8AXf2iRERvTsl1caplwgptpQRJ YPYSJasxOU3lXtpr+equofCtz/qSzCC6cUCwGfhPnDb9a0AoACY7xzCUqj/PpVPK fc9spq0+Je1vlf3SaSSkZ3UoGygrX6XpXL1s54fgFnrINRaMdWidi3aMz8BmkHTQ Tq061yTZBWLfD+lNEYti7dRgtIgS+Ng00bFCHiDIxP8vOg5CrKWnJ0OsXjf6Sc4= =y11r -----END PGP SIGNATURE----- --fL55ljUBDNxRX79wsmtuiwMCJliOpWotw--