From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtLkx-0006yl-Fe for qemu-devel@nongnu.org; Thu, 10 Jan 2013 12:17:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtLkv-0005Bm-Tv for qemu-devel@nongnu.org; Thu, 10 Jan 2013 12:17:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:21348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtLkv-0005Bd-KC for qemu-devel@nongnu.org; Thu, 10 Jan 2013 12:17:29 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0AHHTht023982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 10 Jan 2013 12:17:29 -0500 Message-ID: <50EEF7A4.7090009@redhat.com> Date: Thu, 10 Jan 2013 10:17:24 -0700 From: Eric Blake MIME-Version: 1.0 References: <1357828767-2327-1-git-send-email-pbonzini@redhat.com> In-Reply-To: <1357828767-2327-1-git-send-email-pbonzini@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig391069EDA555C0CAC1ECA598" Subject: Re: [Qemu-devel] [PATCH] block: do not probe zero-sized disks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig391069EDA555C0CAC1ECA598 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/10/2013 07:39 AM, Paolo Bonzini wrote: > A blank CD or DVD is visible as a zero-sized disks. Probing such > disks will lead to an EIO and a failure to start the VM. Treating > them as raw is a better solution. >=20 > Signed-off-by: Paolo Bonzini > --- > block.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/block.c b/block.c > index c05875f..b9da10e 100644 > --- a/block.c > +++ b/block.c > @@ -532,7 +532,7 @@ static int find_image_format(const char *filename, = BlockDriver **pdrv) > } > =20 > /* Return the raw BlockDriver * to scsi-generic devices or empty d= rives */ > - if (bs->sg || !bdrv_is_inserted(bs)) { > + if (bs->sg || !bdrv_is_inserted(bs) || bdrv_getlength(bs) =3D=3D 0= ) { Do we need to extend this to all files with size smaller than the length of the header used in probing to determine a non-raw file? Or is the case of someone passing a 1-byte file as a backing file of a device too unlikely, where refusing to start the VM is okay for that case? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig391069EDA555C0CAC1ECA598 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.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with undefined - http://www.enigmail.net/ iQEcBAEBCAAGBQJQ7vekAAoJEKeha0olJ0Nqm34H/AmA/urx1u/L6S7MfyqwECDB iU4VT+QFjjONcv45qXmagzXkpkafebnE4KKu0yJ5y9Q0njmPM0YovCGdwymP8vdG N8Gv+6qRPSkFydovCa5hOiUJTXldfOQD2zCKBj9HAGeWA3dzGCkeQ2gUgaWCboIe Tu6+AAP5azIrvwPGDH2LmX0+qyIbb33oantHmGAVpT5gMM0On5HKBDLH1ISlBW1t 9MpBYsII9WMXP3+CiQvYGQ7FlJbMJf+DboeZ//r7AYIWIT0i+Un1L5cxsT8VwCZk LZKok+5kg6cHM961axktK1PKZgovdhH0eVRCWpO1LASmf76+5FXQm5lzWbthQmo= =5oE/ -----END PGP SIGNATURE----- --------------enig391069EDA555C0CAC1ECA598--