[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/37] block: Invoke change media CB before NULLing d
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 09/37] block: Invoke change media CB before NULLing drv |
Date: |
Fri, 23 Oct 2015 19:00:56 +0200 |
From: Max Reitz <address@hidden>
In order to handle host device passthrough, some guest device models
may call blk_is_inserted() to check whether the medium is inserted on
the host, when checking the guest tray status.
This tray status is inquired by blk_dev_change_media_cb(); because
bdrv_is_inserted() (invoked by blk_is_inserted()) always returns false
for BDS with drv set to NULL, blk_dev_change_media_cb() should therefore
be called before drv is set to NULL.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block.c b/block.c
index bb8c067..4a75bb7 100644
--- a/block.c
+++ b/block.c
@@ -1912,6 +1912,10 @@ void bdrv_close(BlockDriverState *bs)
bdrv_drain(bs); /* in case flush left pending I/O */
notifier_list_notify(&bs->close_notifiers, bs);
+ if (bs->blk) {
+ blk_dev_change_media_cb(bs->blk, false);
+ }
+
if (bs->drv) {
BdrvChild *child, *next;
@@ -1950,10 +1954,6 @@ void bdrv_close(BlockDriverState *bs)
bs->full_open_options = NULL;
}
- if (bs->blk) {
- blk_dev_change_media_cb(bs->blk, false);
- }
-
QLIST_FOREACH_SAFE(ban, &bs->aio_notifiers, list, ban_next) {
g_free(ban);
}
--
1.8.3.1
- [Qemu-devel] [PULL 00/37] Block layer patches, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 01/37] block: Remove host floppy support, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 02/37] block: Set BDRV_O_INCOMING in bdrv_fill_options(), Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 03/37] blockdev: Allow creation of BDS trees without BB, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 04/37] iotests: Only create BB if necessary, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 05/37] block: Make bdrv_is_inserted() return a bool, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 06/37] block: Add blk_is_available(), Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 07/37] block: Make bdrv_is_inserted() recursive, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 08/37] block/raw_bsd: Drop raw_is_inserted(), Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 09/37] block: Invoke change media CB before NULLing drv,
Kevin Wolf <=
- [Qemu-devel] [PULL 10/37] hw/block/fdc: Implement tray status, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 11/37] hw/usb-storage: Check whether BB is inserted, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 15/37] block: Move BlockAcctStats into BlockBackend, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 17/37] block/throttle-groups: Make incref/decref public, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 13/37] block: Move guest_block_size into BlockBackend, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 12/37] block: Fix BB AIOCB AioContext without BDS, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 18/37] block: Add BlockBackendRootState, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 14/37] block: Remove wr_highest_sector from BlockAcctStats, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 21/37] block: Prepare remaining BB functions for NULL BDS, Kevin Wolf, 2015/10/23
- [Qemu-devel] [PULL 22/37] block: Add blk_insert_bs(), Kevin Wolf, 2015/10/23