mirror of
https://github.com/qemu/qemu.git
synced 2025-08-09 10:25:06 +00:00
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>
This commit is contained in:
parent
7467d94cc4
commit
fc27291daf
4
block.c
4
block.c
@ -2154,9 +2154,10 @@ void bdrv_close(BlockDriverState *bs)
|
|||||||
bdrv_io_limits_disable(bs);
|
bdrv_io_limits_disable(bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
bdrv_drain(bs); /* complete I/O */
|
bdrv_drained_begin(bs); /* complete I/O */
|
||||||
bdrv_flush(bs);
|
bdrv_flush(bs);
|
||||||
bdrv_drain(bs); /* in case flush left pending I/O */
|
bdrv_drain(bs); /* in case flush left pending I/O */
|
||||||
|
|
||||||
notifier_list_notify(&bs->close_notifiers, bs);
|
notifier_list_notify(&bs->close_notifiers, bs);
|
||||||
|
|
||||||
if (bs->blk) {
|
if (bs->blk) {
|
||||||
@ -2206,6 +2207,7 @@ void bdrv_close(BlockDriverState *bs)
|
|||||||
g_free(ban);
|
g_free(ban);
|
||||||
}
|
}
|
||||||
QLIST_INIT(&bs->aio_notifiers);
|
QLIST_INIT(&bs->aio_notifiers);
|
||||||
|
bdrv_drained_end(bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bdrv_close_all(void)
|
void bdrv_close_all(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user