From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32864) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDcc-0000fJ-1k for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:24:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGDcY-0004oQ-NQ for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:24:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDcY-0004mE-Ed for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:24:26 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0RLOPW3021156 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 27 Jan 2015 16:24:25 -0500 Message-ID: <54C80208.7080705@redhat.com> Date: Tue, 27 Jan 2015 14:24:24 -0700 From: Eric Blake MIME-Version: 1.0 References: <1422387983-32153-1-git-send-email-mreitz@redhat.com> <1422387983-32153-16-git-send-email-mreitz@redhat.com> In-Reply-To: <1422387983-32153-16-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FaO4shfSG7LqghgDnsXM5bkVWhoot4nND" Subject: Re: [Qemu-devel] [PATCH RESEND 15/50] block: Fail requests to empty BlockBackend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Jeff Cody , Markus Armbruster , Stefan Hajnoczi , John Snow This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --FaO4shfSG7LqghgDnsXM5bkVWhoot4nND Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/27/2015 12:45 PM, Max Reitz wrote: > If there is no BlockDriverState in a BlockBackend or if the tray of the= > guest device is open, fail all requests (where that is possible) with > -ENOMEDIUM. >=20 > The reason the status of the guest device is taken into account is > because once the guest device's tray is opened, any request on the same= > BlockBackend as the guest uses should fail. If the BDS tree is supposed= > to be usable even after ejecting it from the guest, a different > BlockBackend must be used. >=20 > Signed-off-by: Max Reitz > --- > block/block-backend.c | 43 ++++++++++++++++++++++++++++++++++++++++++-= > 1 file changed, 42 insertions(+), 1 deletion(-) >=20 > @@ -635,6 +635,10 @@ int blk_pwrite(BlockBackend *blk, int64_t offset, = const void *buf, int count) > =20 > int64_t blk_getlength(BlockBackend *blk) > { > + if (!blk_is_available(blk)) { > + return -ENOMEDIUM; > + } > + > return bdrv_getlength(blk->bs); > } If you add blk_nb_sectors, it will probably need the same treatment. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --FaO4shfSG7LqghgDnsXM5bkVWhoot4nND 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJUyAIIAAoJEKeha0olJ0Nq6TAH/RIFDw+Q2wnATcySDiSnRf0U p8u4YYs792K1pyWt5O+CxegFYFVnfkk1uEQ/m0yy9pSqtPv9G8HtV+Y0HXIxUOZJ tFkrHUlY2hXiFFHsyd9JBPNQYKkRtvlcrFYhorgd6+jzzx5oKW5Pwa+q8iiR/5st dEAJvmKkwmrNqnvDaKMqL24jdxZHSYWuAQctBS7x54ljV8htu9CgSADgFXwZrysZ SHQIN8dEz+eyjaRKGv+fl9+oVX1wbSQrvwjhWZyvj2qBOl74i9ljhT1+rSyOomGd CulGB5+eGeqdmn8bbE5gRbP11pWAvIpZcCU3lEE/3AcDezrfIgT3znHeevHAhAU= =ptJf -----END PGP SIGNATURE----- --FaO4shfSG7LqghgDnsXM5bkVWhoot4nND--