diff options
author | Emanuele Giuseppe Esposito <eesposit@redhat.com> | 2023-02-03 16:21:46 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-02-23 19:49:12 +0100 |
commit | 880953493386a69416d2e1cdc063c670585a03ac (patch) | |
tree | ce0deae2dc99760b4d124af36641d116efb5f561 /block/io.c | |
parent | c16b8bd4e5b423dac556cc37a81efeea4bba9cfe (diff) | |
download | qemu-880953493386a69416d2e1cdc063c670585a03ac.zip qemu-880953493386a69416d2e1cdc063c670585a03ac.tar.gz qemu-880953493386a69416d2e1cdc063c670585a03ac.tar.bz2 |
block: Mark bdrv_co_flush() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of
bdrv_co_flush() need to hold a reader lock for the graph.
For some places, we know that they will hold the lock, but we don't have
the GRAPH_RDLOCK annotations yet. In this case, add assume_graph_lock()
with a FIXME comment. These places will be removed once everything is
properly annotated.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230203152202.49054-8-kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r-- | block/io.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -933,6 +933,8 @@ int coroutine_fn bdrv_co_pwrite_sync(BdrvChild *child, int64_t offset, int ret; IO_CODE(); + assume_graph_lock(); /* FIXME */ + ret = bdrv_co_pwrite(child, offset, bytes, buf, flags); if (ret < 0) { return ret; @@ -1041,6 +1043,8 @@ static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs, QEMUIOVector local_qiov; int ret; + assume_graph_lock(); /* FIXME */ + bdrv_check_qiov_request(offset, bytes, qiov, qiov_offset, &error_abort); if (!drv) { @@ -1680,6 +1684,8 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, int head = 0; int tail = 0; + assume_graph_lock(); /* FIXME */ + int64_t max_write_zeroes = MIN_NON_ZERO(bs->bl.max_pwrite_zeroes, INT64_MAX); int alignment = MAX(bs->bl.pwrite_zeroes_alignment, @@ -2839,6 +2845,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs) int ret = 0; IO_CODE(); + assert_bdrv_graph_readable(); bdrv_inc_in_flight(bs); if (!bdrv_co_is_inserted(bs) || bdrv_is_read_only(bs) || |