diff options
-rw-r--r-- | block.c | 2 | ||||
-rw-r--r-- | block/block-backend.c | 2 | ||||
-rw-r--r-- | block/copy-on-read.c | 6 | ||||
-rw-r--r-- | block/filter-compress.c | 4 | ||||
-rw-r--r-- | block/raw-format.c | 6 | ||||
-rw-r--r-- | include/block/block-io.h | 7 | ||||
-rw-r--r-- | include/block/block_int-common.h | 6 |
7 files changed, 23 insertions, 10 deletions
@@ -6849,6 +6849,7 @@ void coroutine_fn bdrv_co_eject(BlockDriverState *bs, bool eject_flag) { BlockDriver *drv = bs->drv; IO_CODE(); + assert_bdrv_graph_readable(); if (drv && drv->bdrv_co_eject) { drv->bdrv_co_eject(bs, eject_flag); @@ -6863,6 +6864,7 @@ void coroutine_fn bdrv_co_lock_medium(BlockDriverState *bs, bool locked) { BlockDriver *drv = bs->drv; IO_CODE(); + assert_bdrv_graph_readable(); trace_bdrv_lock_medium(bs, locked); if (drv && drv->bdrv_co_lock_medium) { diff --git a/block/block-backend.c b/block/block-backend.c index 20af699..278b04c 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -2013,6 +2013,7 @@ void coroutine_fn blk_co_lock_medium(BlockBackend *blk, bool locked) { BlockDriverState *bs = blk_bs(blk); IO_CODE(); + GRAPH_RDLOCK_GUARD(); if (bs) { bdrv_co_lock_medium(bs, locked); @@ -2024,6 +2025,7 @@ void coroutine_fn blk_co_eject(BlockBackend *blk, bool eject_flag) BlockDriverState *bs = blk_bs(blk); char *id; IO_CODE(); + GRAPH_RDLOCK_GUARD(); if (bs) { bdrv_co_eject(bs, eject_flag); diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 78da353..20215cf 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -213,13 +213,15 @@ cor_co_pwritev_compressed(BlockDriverState *bs, int64_t offset, int64_t bytes, } -static void coroutine_fn cor_co_eject(BlockDriverState *bs, bool eject_flag) +static void coroutine_fn GRAPH_RDLOCK +cor_co_eject(BlockDriverState *bs, bool eject_flag) { bdrv_co_eject(bs->file->bs, eject_flag); } -static void coroutine_fn cor_co_lock_medium(BlockDriverState *bs, bool locked) +static void coroutine_fn GRAPH_RDLOCK +cor_co_lock_medium(BlockDriverState *bs, bool locked) { bdrv_co_lock_medium(bs->file->bs, locked); } diff --git a/block/filter-compress.c b/block/filter-compress.c index 0dd5606..c7d50a6 100644 --- a/block/filter-compress.c +++ b/block/filter-compress.c @@ -114,14 +114,14 @@ static void compress_refresh_limits(BlockDriverState *bs, Error **errp) } -static void coroutine_fn +static void coroutine_fn GRAPH_RDLOCK compress_co_eject(BlockDriverState *bs, bool eject_flag) { bdrv_co_eject(bs->file->bs, eject_flag); } -static void coroutine_fn +static void coroutine_fn GRAPH_RDLOCK compress_co_lock_medium(BlockDriverState *bs, bool locked) { bdrv_co_lock_medium(bs->file->bs, locked); diff --git a/block/raw-format.c b/block/raw-format.c index 646606e..f4203d4 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -405,12 +405,14 @@ raw_co_truncate(BlockDriverState *bs, int64_t offset, bool exact, return bdrv_co_truncate(bs->file, offset, exact, prealloc, flags, errp); } -static void coroutine_fn raw_co_eject(BlockDriverState *bs, bool eject_flag) +static void coroutine_fn GRAPH_RDLOCK +raw_co_eject(BlockDriverState *bs, bool eject_flag) { bdrv_co_eject(bs->file->bs, eject_flag); } -static void coroutine_fn raw_co_lock_medium(BlockDriverState *bs, bool locked) +static void coroutine_fn GRAPH_RDLOCK +raw_co_lock_medium(BlockDriverState *bs, bool locked) { bdrv_co_lock_medium(bs->file->bs, locked); } diff --git a/include/block/block-io.h b/include/block/block-io.h index 88db634..bf27480 100644 --- a/include/block/block-io.h +++ b/include/block/block-io.h @@ -148,8 +148,11 @@ int bdrv_get_flags(BlockDriverState *bs); bool coroutine_fn GRAPH_RDLOCK bdrv_co_is_inserted(BlockDriverState *bs); bool co_wrapper_bdrv_rdlock bdrv_is_inserted(BlockDriverState *bs); -void coroutine_fn bdrv_co_lock_medium(BlockDriverState *bs, bool locked); -void coroutine_fn bdrv_co_eject(BlockDriverState *bs, bool eject_flag); +void coroutine_fn GRAPH_RDLOCK +bdrv_co_lock_medium(BlockDriverState *bs, bool locked); + +void coroutine_fn GRAPH_RDLOCK +bdrv_co_eject(BlockDriverState *bs, bool eject_flag); const char *bdrv_get_format_name(BlockDriverState *bs); diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h index b4a8226..30e6bd4 100644 --- a/include/block/block_int-common.h +++ b/include/block/block_int-common.h @@ -714,8 +714,10 @@ struct BlockDriver { /* removable device specific */ bool coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_is_inserted)( BlockDriverState *bs); - void coroutine_fn (*bdrv_co_eject)(BlockDriverState *bs, bool eject_flag); - void coroutine_fn (*bdrv_co_lock_medium)(BlockDriverState *bs, bool locked); + void coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_eject)( + BlockDriverState *bs, bool eject_flag); + void coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_lock_medium)( + BlockDriverState *bs, bool locked); /* to control generic scsi devices */ BlockAIOCB *coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_aio_ioctl)( |