diff options
author | Kevin Wolf <kwolf@redhat.com> | 2023-10-27 17:53:10 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-11-07 19:14:19 +0100 |
commit | 221caadcc5129d3ec5ad9ecfd7374de0f7050316 (patch) | |
tree | 8ea708d1d163ca44332f056fd9e19ed3a71fabbd /block | |
parent | 462ad017ed76889d46696a3581e1b52343f9b683 (diff) |
block: Mark bdrv_probe_blocksizes() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of
bdrv_probe_blocksizes() need to hold a reader lock for the graph because
it calls bdrv_filter_bs(), which accesses bs->file/backing.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231027155333.420094-2-kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/block-backend.c | 2 | ||||
-rw-r--r-- | block/raw-format.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/block/block-backend.c b/block/block-backend.c index 39aac1bbce..53cf3bb8b8 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -2666,6 +2666,8 @@ int blk_load_vmstate(BlockBackend *blk, uint8_t *buf, int64_t pos, int size) int blk_probe_blocksizes(BlockBackend *blk, BlockSizes *bsz) { GLOBAL_STATE_CODE(); + GRAPH_RDLOCK_GUARD_MAINLOOP(); + if (!blk_is_available(blk)) { return -ENOMEDIUM; } diff --git a/block/raw-format.c b/block/raw-format.c index 8ff03adfa4..3fb77b0097 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -543,7 +543,8 @@ static int raw_probe(const uint8_t *buf, int buf_size, const char *filename) return 1; } -static int raw_probe_blocksizes(BlockDriverState *bs, BlockSizes *bsz) +static int GRAPH_RDLOCK +raw_probe_blocksizes(BlockDriverState *bs, BlockSizes *bsz) { BDRVRawState *s = bs->opaque; int ret; |