mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 15:15:46 +00:00
block: Mark bdrv_apply_auto_read_only() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_apply_auto_read_only() need to hold a reader lock for the graph because it calls bdrv_can_set_read_only(), which indirectly accesses the parents list of a node. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20230929145157.45443-19-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
4
block.c
4
block.c
@ -320,8 +320,6 @@ int bdrv_apply_auto_read_only(BlockDriverState *bs, const char *errmsg,
|
||||
int ret = 0;
|
||||
IO_CODE();
|
||||
|
||||
assume_graph_lock(); /* FIXME */
|
||||
|
||||
if (!(bs->open_flags & BDRV_O_RDWR)) {
|
||||
return 0;
|
||||
}
|
||||
@ -1908,7 +1906,9 @@ static int bdrv_open_common(BlockDriverState *bs, BlockBackend *file,
|
||||
|
||||
if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, ro)) {
|
||||
if (!ro && bdrv_is_whitelisted(drv, true)) {
|
||||
bdrv_graph_rdlock_main_loop();
|
||||
ret = bdrv_apply_auto_read_only(bs, NULL, NULL);
|
||||
bdrv_graph_rdunlock_main_loop();
|
||||
} else {
|
||||
ret = -ENOTSUP;
|
||||
}
|
||||
|
Reference in New Issue
Block a user