summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-12-23 11:48:24 +0100
committerMax Reitz <mreitz@redhat.com>2016-01-07 21:30:17 +0100
commitfc27291dafbb5ae39dfc43f22cae867d442ac5ab (patch)
tree0c441f02a0dc10c8394e1655cb07823421a3ff62 /block.c
parent7467d94cc43d3bea91160dba6ad42c07da217219 (diff)
downloadqemu-fc27291dafbb5ae39dfc43f22cae867d442ac5ab.tar.gz
qemu-fc27291dafbb5ae39dfc43f22cae867d442ac5ab.tar.bz2
qemu-fc27291dafbb5ae39dfc43f22cae867d442ac5ab.zip
block: use drained section in bdrv_close
bdrv_close is used when ejecting a medium. Use a drained section to ensure that all I/O goes to either the old medium or the bitbucket. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1450867706-19860-2-git-send-email-pbonzini@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block.c b/block.c
index 411edbf9fc..01655ded13 100644
--- a/block.c
+++ b/block.c
@@ -2154,9 +2154,10 @@ void bdrv_close(BlockDriverState *bs)
bdrv_io_limits_disable(bs);
}
- 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);
if (bs->blk) {
@@ -2206,6 +2207,7 @@ void bdrv_close(BlockDriverState *bs)
g_free(ban);
}
QLIST_INIT(&bs->aio_notifiers);
+ bdrv_drained_end(bs);
}
void bdrv_close_all(void)