From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5Nup-0005zj-SF for qemu-devel@nongnu.org; Fri, 02 Aug 2013 18:33:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5Nuk-0005kr-UY for qemu-devel@nongnu.org; Fri, 02 Aug 2013 18:33:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5Nuk-0005kd-M9 for qemu-devel@nongnu.org; Fri, 02 Aug 2013 18:33:38 -0400 Message-ID: <51FC33BD.8010309@redhat.com> Date: Fri, 02 Aug 2013 16:33:33 -0600 From: Eric Blake MIME-Version: 1.0 References: <1375434137-4452-1-git-send-email-gesaint@linux.vnet.ibm.com> <1375434137-4452-7-git-send-email-gesaint@linux.vnet.ibm.com> In-Reply-To: <1375434137-4452-7-git-send-email-gesaint@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ujCIgLnlePTTBTnK4isSosC1wm83o0M90" Subject: Re: [Qemu-devel] [PATCH V5 6/6] block: Add infinite loop check in drive_init() 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) --ujCIgLnlePTTBTnK4isSosC1wm83o0M90 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 > Backing file should be checked if there is a loop in it during image > boot. Becase if there is loop qemu would no response for a long time s/Becase/Because/ > and segment fault occured. So this patch would check backing file s/occured/occurred/ > chain if there is loop in it before open image. I'd suggest: Check the backing file for a loop during image boot, to avoid a lack or response or segfault. >=20 > Signed-off-by: Xu Wang > --- > blockdev.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/blockdev.c b/blockdev.c > index b3a57e0..590193f 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -695,6 +695,13 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInt= erfaceType block_default_type) > error_report("warning: disabling copy_on_read on readonly driv= e"); > } > =20 > + /* Add backing file loop check */ > + if (bdrv_backing_file_loop_check(file, drv ? drv->format_name : NU= LL, > + NULL, NULL)) { > + error_report("drive_init: backing file loop check failed!"); The '!' seems a bit of overkill; it is sufficient to give an error message without trailing punctuation. > + goto err; > + } > + > ret =3D bdrv_open(dinfo->bdrv, file, bs_opts, bdrv_flags, drv); > bs_opts =3D NULL; > =20 >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --ujCIgLnlePTTBTnK4isSosC1wm83o0M90 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/DO9AAoJEKeha0olJ0NqJlIH/2jY2p98mdb62jayuHDELaUJ EQNQfZGvBG1BoV1Oma3jObYZi/L5ehGYkBjF9W2EOJ0hj8bQ2H51+VFz+GAiLWRs 6BPvWMenBnQbfjuXNSQZJyiG9c1RqYJG87OOUE2ZnU1LbjZlAhv8zJJaZe6E41j/ JVh+jFM4sVYlUxFn+DokuheQuTCrdlg7mdQIZ01lWSdhS61hwfKmSC4u+FVdR5pi Oea11CDrqscOmLzaYA+n2G/RZbCFeTsKzP+QhhRryaVVPw18OSyEySDnA75Jac2S RpyvBwAsqIDY9cHcsBnszZ1AkSlplkDkY1x6RS2Y+ic8gn3Yi/uwcugAVT4ytiY= =tpo8 -----END PGP SIGNATURE----- --ujCIgLnlePTTBTnK4isSosC1wm83o0M90--