mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
block: Mark bdrv_root_attach_child() GRAPH_WRLOCK
Instead of taking the writer lock internally, require callers to already hold it when calling bdrv_root_attach_child(). These callers will typically already hold the graph lock once the locking work is completed, which means that they can't call functions that take it internally. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20231027155333.420094-5-kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
f5a3a270fe
commit
03b9eaca54
4 changed files with 12 additions and 10 deletions
5
block.c
5
block.c
|
@ -3214,8 +3214,6 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
|
|||
|
||||
GLOBAL_STATE_CODE();
|
||||
|
||||
bdrv_graph_wrlock(child_bs);
|
||||
|
||||
child = bdrv_attach_child_common(child_bs, child_name, child_class,
|
||||
child_role, perm, shared_perm, opaque,
|
||||
tran, errp);
|
||||
|
@ -3228,9 +3226,8 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
|
|||
|
||||
out:
|
||||
tran_finalize(tran, ret);
|
||||
bdrv_graph_wrunlock();
|
||||
|
||||
bdrv_unref(child_bs);
|
||||
bdrv_schedule_unref(child_bs);
|
||||
|
||||
return ret < 0 ? NULL : child;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue