@@ -1895,6 +1895,7 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state)
void bdrv_close(BlockDriverState *bs)
{
BdrvAioNotifier *ban, *ban_next;
+ AioContext *ctx;
if (bs->job) {
block_job_cancel_sync(bs->job);
@@ -1905,9 +1906,13 @@ void bdrv_close(BlockDriverState *bs)
bdrv_io_limits_disable(bs);
}
+ ctx = bdrv_get_aio_context(bs);
+ aio_context_acquire(ctx);
bdrv_drain(bs); /* complete I/O */
bdrv_flush(bs);
bdrv_drain(bs); /* in case flush left pending I/O */
+ aio_context_release(ctx);
+
notifier_list_notify(&bs->close_notifiers, bs);
if (bs->blk) {
bdrv_close is called in tooooo much places to properly track at the moment. Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Stefan Hajnoczi <stefanha@redhat.com> --- block.c | 5 +++++ 1 file changed, 5 insertions(+)