block: Mark bdrv_co_io_(un)plug() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_co_io_plug() and bdrv_co_io_unplug() need to hold a reader lock for the graph. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20230203152202.49054-18-kwolf@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
4ec8df0183
commit
c382706925
@ -2328,6 +2328,7 @@ void coroutine_fn blk_co_io_plug(BlockBackend *blk)
|
|||||||
{
|
{
|
||||||
BlockDriverState *bs = blk_bs(blk);
|
BlockDriverState *bs = blk_bs(blk);
|
||||||
IO_CODE();
|
IO_CODE();
|
||||||
|
GRAPH_RDLOCK_GUARD();
|
||||||
|
|
||||||
if (bs) {
|
if (bs) {
|
||||||
bdrv_co_io_plug(bs);
|
bdrv_co_io_plug(bs);
|
||||||
@ -2338,6 +2339,7 @@ void coroutine_fn blk_co_io_unplug(BlockBackend *blk)
|
|||||||
{
|
{
|
||||||
BlockDriverState *bs = blk_bs(blk);
|
BlockDriverState *bs = blk_bs(blk);
|
||||||
IO_CODE();
|
IO_CODE();
|
||||||
|
GRAPH_RDLOCK_GUARD();
|
||||||
|
|
||||||
if (bs) {
|
if (bs) {
|
||||||
bdrv_co_io_unplug(bs);
|
bdrv_co_io_unplug(bs);
|
||||||
|
@ -3153,6 +3153,7 @@ void coroutine_fn bdrv_co_io_plug(BlockDriverState *bs)
|
|||||||
{
|
{
|
||||||
BdrvChild *child;
|
BdrvChild *child;
|
||||||
IO_CODE();
|
IO_CODE();
|
||||||
|
assert_bdrv_graph_readable();
|
||||||
|
|
||||||
QLIST_FOREACH(child, &bs->children, next) {
|
QLIST_FOREACH(child, &bs->children, next) {
|
||||||
bdrv_co_io_plug(child->bs);
|
bdrv_co_io_plug(child->bs);
|
||||||
@ -3170,6 +3171,7 @@ void coroutine_fn bdrv_co_io_unplug(BlockDriverState *bs)
|
|||||||
{
|
{
|
||||||
BdrvChild *child;
|
BdrvChild *child;
|
||||||
IO_CODE();
|
IO_CODE();
|
||||||
|
assert_bdrv_graph_readable();
|
||||||
|
|
||||||
assert(bs->io_plugged);
|
assert(bs->io_plugged);
|
||||||
if (qatomic_fetch_dec(&bs->io_plugged) == 1) {
|
if (qatomic_fetch_dec(&bs->io_plugged) == 1) {
|
||||||
|
@ -233,8 +233,8 @@ void coroutine_fn bdrv_co_leave(BlockDriverState *bs, AioContext *old_ctx);
|
|||||||
|
|
||||||
AioContext *child_of_bds_get_parent_aio_context(BdrvChild *c);
|
AioContext *child_of_bds_get_parent_aio_context(BdrvChild *c);
|
||||||
|
|
||||||
void coroutine_fn bdrv_co_io_plug(BlockDriverState *bs);
|
void coroutine_fn GRAPH_RDLOCK bdrv_co_io_plug(BlockDriverState *bs);
|
||||||
void coroutine_fn bdrv_co_io_unplug(BlockDriverState *bs);
|
void coroutine_fn GRAPH_RDLOCK bdrv_co_io_unplug(BlockDriverState *bs);
|
||||||
|
|
||||||
bool coroutine_fn bdrv_co_can_store_new_dirty_bitmap(BlockDriverState *bs,
|
bool coroutine_fn bdrv_co_can_store_new_dirty_bitmap(BlockDriverState *bs,
|
||||||
const char *name,
|
const char *name,
|
||||||
|
@ -735,8 +735,9 @@ struct BlockDriver {
|
|||||||
BlkdebugEvent event);
|
BlkdebugEvent event);
|
||||||
|
|
||||||
/* io queue for linux-aio */
|
/* io queue for linux-aio */
|
||||||
void coroutine_fn (*bdrv_co_io_plug)(BlockDriverState *bs);
|
void coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_io_plug)(BlockDriverState *bs);
|
||||||
void coroutine_fn (*bdrv_co_io_unplug)(BlockDriverState *bs);
|
void coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_io_unplug)(
|
||||||
|
BlockDriverState *bs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bdrv_drain_begin is called if implemented in the beginning of a
|
* bdrv_drain_begin is called if implemented in the beginning of a
|
||||||
|
Loading…
Reference in New Issue
Block a user