From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBr0e-0005Gv-7I for qemu-devel@nongnu.org; Wed, 23 Dec 2015 16:31:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBr0d-0000na-DI for qemu-devel@nongnu.org; Wed, 23 Dec 2015 16:31:48 -0500 References: <1450867706-19860-2-git-send-email-pbonzini@redhat.com> From: Max Reitz Message-ID: <567B12B6.7030308@redhat.com> Date: Wed, 23 Dec 2015 22:31:34 +0100 MIME-Version: 1.0 In-Reply-To: <1450867706-19860-2-git-send-email-pbonzini@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5DlQljtcLntVGXdmM22Ju2dnWIw2CSw7H" Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block: use drained section in bdrv_close List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --5DlQljtcLntVGXdmM22Ju2dnWIw2CSw7H Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 23.12.2015 11:48, Paolo Bonzini wrote: > bdrv_close is used when ejecting a medium. Is it still? Other than it maybe being indirectly called through bdrv_delete(), it shouldn't be. > Use a drained section to en= sure > that all I/O goes to either the old medium or the bitbucket. Since the BDS will be deleted after bdrv_close() has been called, where else would the I/O go now? Max > Signed-off-by: Paolo Bonzini > --- > block.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/block.c b/block.c > index 411edbf..01655de 100644 > --- a/block.c > +++ b/block.c > @@ -2154,9 +2154,10 @@ void bdrv_close(BlockDriverState *bs) > bdrv_io_limits_disable(bs); > } > =20 > - bdrv_drain(bs); /* complete I/O */ > + bdrv_drained_begin(bs); /* complete I/O */ > bdrv_flush(bs); > bdrv_drain(bs); /* in case flush left pending I/O */ > + > notifier_list_notify(&bs->close_notifiers, bs); > =20 > if (bs->blk) { > @@ -2206,6 +2207,7 @@ void bdrv_close(BlockDriverState *bs) > g_free(ban); > } > QLIST_INIT(&bs->aio_notifiers); > + bdrv_drained_end(bs); > } > =20 > void bdrv_close_all(void) >=20 --5DlQljtcLntVGXdmM22Ju2dnWIw2CSw7H 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 iQEcBAEBCAAGBQJWexK2AAoJEDuxQgLoOKytWEAH/ivH6ENQfnA2dew0bv+zSTka HeP+w/siyJg5/vnp5cQpeoNYwZ/OXRtQKGzFi9SSnRlHO3MGJ9V7DJJdkuPna4a8 3VgCXl9kv1+/ZwKaqmOZx7fOVk6Tt8Nko/KGIvM8QY6ONUSzU8kfO8fdEVpq/fEM JCpdKRSrOLZucj8mFQptqquUlX9SZl2Hfnb/XVFoTckSUL2AJ8QE3Y0NsydpPzCS u6IUZw/RVWDJxWhGLVXO+2o7iS6+McpH8bFG/os6I15ft08rUXT27FkYiErjr7CJ PMwRX4pUkZ1s3nYeDM2gTa6p0g01XL1hFXftjrybk108BuzuStDjPzntbukpzR0= =zR3X -----END PGP SIGNATURE----- --5DlQljtcLntVGXdmM22Ju2dnWIw2CSw7H--