mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-18 23:52:14 -06:00
block: Take graph rdlock in bdrv_inactivate_all()
The function reads the parents list, so it needs to hold the graph lock. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20230929145157.45443-4-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
e84c07bc73
commit
0e6bad1f21
1 changed files with 4 additions and 3 deletions
7
block.c
7
block.c
|
@ -6976,7 +6976,8 @@ void bdrv_activate_all(Error **errp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool bdrv_has_bds_parent(BlockDriverState *bs, bool only_active)
|
static bool GRAPH_RDLOCK
|
||||||
|
bdrv_has_bds_parent(BlockDriverState *bs, bool only_active)
|
||||||
{
|
{
|
||||||
BdrvChild *parent;
|
BdrvChild *parent;
|
||||||
GLOBAL_STATE_CODE();
|
GLOBAL_STATE_CODE();
|
||||||
|
@ -6993,14 +6994,13 @@ static bool bdrv_has_bds_parent(BlockDriverState *bs, bool only_active)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bdrv_inactivate_recurse(BlockDriverState *bs)
|
static int GRAPH_RDLOCK bdrv_inactivate_recurse(BlockDriverState *bs)
|
||||||
{
|
{
|
||||||
BdrvChild *child, *parent;
|
BdrvChild *child, *parent;
|
||||||
int ret;
|
int ret;
|
||||||
uint64_t cumulative_perms, cumulative_shared_perms;
|
uint64_t cumulative_perms, cumulative_shared_perms;
|
||||||
|
|
||||||
GLOBAL_STATE_CODE();
|
GLOBAL_STATE_CODE();
|
||||||
GRAPH_RDLOCK_GUARD_MAINLOOP();
|
|
||||||
|
|
||||||
if (!bs->drv) {
|
if (!bs->drv) {
|
||||||
return -ENOMEDIUM;
|
return -ENOMEDIUM;
|
||||||
|
@ -7066,6 +7066,7 @@ int bdrv_inactivate_all(void)
|
||||||
GSList *aio_ctxs = NULL, *ctx;
|
GSList *aio_ctxs = NULL, *ctx;
|
||||||
|
|
||||||
GLOBAL_STATE_CODE();
|
GLOBAL_STATE_CODE();
|
||||||
|
GRAPH_RDLOCK_GUARD_MAINLOOP();
|
||||||
|
|
||||||
for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
|
for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
|
||||||
AioContext *aio_context = bdrv_get_aio_context(bs);
|
AioContext *aio_context = bdrv_get_aio_context(bs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue