From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCoGF-0001bA-1C for qemu-devel@nongnu.org; Tue, 14 Jun 2016 09:20:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCoG8-0001c0-Oy for qemu-devel@nongnu.org; Tue, 14 Jun 2016 09:20:05 -0400 References: <1465595961-4762-1-git-send-email-jsnow@redhat.com> From: Max Reitz Message-ID: <905ed66e-9f55-b27f-6a98-1c2a845f3759@redhat.com> Date: Tue, 14 Jun 2016 15:19:50 +0200 MIME-Version: 1.0 In-Reply-To: <1465595961-4762-1-git-send-email-jsnow@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="SpaK5pb1BpLdcKjalVFf5bUC5AeqmC9MR" Subject: Re: [Qemu-devel] [PATCH] block-backend: allow flush on devices with open tray List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow , qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --SpaK5pb1BpLdcKjalVFf5bUC5AeqmC9MR From: Max Reitz To: John Snow , qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org Message-ID: <905ed66e-9f55-b27f-6a98-1c2a845f3759@redhat.com> Subject: Re: [PATCH] block-backend: allow flush on devices with open tray References: <1465595961-4762-1-git-send-email-jsnow@redhat.com> In-Reply-To: <1465595961-4762-1-git-send-email-jsnow@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 10.06.2016 23:59, John Snow wrote: > If a device still has an attached BDS because the medium has not yet > been removed, we will be unable to migrate to a new host because > blk_flush will return an error for that backend. >=20 > Replace the call to blk_is_available to blk_is_inserted to weaken > the check and allow flushes from the backend to work, while still > disallowing flushes from the frontend/device model to work. >=20 > This fixes a regression present in 2.6.0 caused by the following commit= : > fe1a9cbc339bb54d20f1ca4c1e8788d16944d5cf > block: Move some bdrv_*_all() functions to BB >=20 > Signed-off-by: John Snow > --- > block/block-backend.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) I'm still not sure we shouldn't do the same for blk_{co,aio}_flush(). I guess you exclude them here because you specifically want to fix the issue mentioned in the commit message, but then we could just make blk_flush_all() ignore an -ENOMEDIUM. I personally think we should make all blk_*flush() functions use blk_is_inserted() instead of blk_is_available(). As we have discussed on IRC, there are probably not that many cases a guest can flush a medium in an open tray anyway (because the main use case are read-only CD-ROMs), and even if so, that wouldn't change any data, so even if the guest can actually flush something on an open tray, I don't think anyone would complain. Max > diff --git a/block/block-backend.c b/block/block-backend.c > index 34500e6..d1e875e 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c > @@ -1122,7 +1122,7 @@ int blk_co_flush(BlockBackend *blk) > =20 > int blk_flush(BlockBackend *blk) > { > - if (!blk_is_available(blk)) { > + if (!blk_is_inserted(blk)) { > return -ENOMEDIUM; > } > =20 >=20 --SpaK5pb1BpLdcKjalVFf5bUC5AeqmC9MR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXYAR2AAoJEDuxQgLoOKytM9gH/2o21a+32M42cjQ6qsJtQCuB GaUHvAUwlYhSMMNTix66FgS+A1iDFt/c0a/t54IqtHm0Hbysygt+ALqSHm08YmTb ca6l0znWWFezU4zvemJLurhqaaSdnMRA0YbFjUfRozTeyfsLQYP4bEzuC/a5FEGM UxyB8kXC9lzQNjkmbRlHuqzCtUQ+Tdat8rwA8itCii70nSGMzMD23mM071kaedPG ywgvIb5buJEw4DMAiScT/50cWmWHceXkPtdLjqY+6+bkkRhvHQVF4vYsPGhn8/w6 nAyfYvO7dLstI6yHbZfBUmRLxPj7KRaZ8H35DOd0MRraViu/tAynBWq0ZFTjA8I= =g3uB -----END PGP SIGNATURE----- --SpaK5pb1BpLdcKjalVFf5bUC5AeqmC9MR--