mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00
block: move drain outside of quorum_del_child()
The quorum_del_child() callback runs under the graph lock, so it is not allowed to drain. It is only called as the .bdrv_del_child() callback, which is only called in the bdrv_del_child() function, which also runs under the graph lock. The bdrv_del_child() function is called by qmp_x_blockdev_change(). A drained section was already introduced there by commit "block: move drain out of quorum_add_child()". This finally finishes moving out the drain to places that are not under the graph lock started in "block: move draining out of bdrv_change_aio_context() and mark GRAPH_RDLOCK". Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Message-ID: <20250530151125.955508-17-f.ebner@proxmox.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
b13f546545
commit
d75f8ed1d7
3 changed files with 9 additions and 2 deletions
2
block.c
2
block.c
|
@ -8276,6 +8276,8 @@ void bdrv_add_child(BlockDriverState *parent_bs, BlockDriverState *child_bs,
|
||||||
/*
|
/*
|
||||||
* Hot remove a BDS's child. Used in combination with bdrv_add_child, so the
|
* Hot remove a BDS's child. Used in combination with bdrv_add_child, so the
|
||||||
* user can take a child offline when it is broken and take a new child online.
|
* user can take a child offline when it is broken and take a new child online.
|
||||||
|
*
|
||||||
|
* All block nodes must be drained.
|
||||||
*/
|
*/
|
||||||
void bdrv_del_child(BlockDriverState *parent_bs, BdrvChild *child, Error **errp)
|
void bdrv_del_child(BlockDriverState *parent_bs, BdrvChild *child, Error **errp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1147,9 +1147,7 @@ quorum_del_child(BlockDriverState *bs, BdrvChild *child, Error **errp)
|
||||||
(s->num_children - i - 1) * sizeof(BdrvChild *));
|
(s->num_children - i - 1) * sizeof(BdrvChild *));
|
||||||
s->children = g_renew(BdrvChild *, s->children, --s->num_children);
|
s->children = g_renew(BdrvChild *, s->children, --s->num_children);
|
||||||
|
|
||||||
bdrv_drain_all_begin();
|
|
||||||
bdrv_unref_child(bs, child);
|
bdrv_unref_child(bs, child);
|
||||||
bdrv_drain_all_end();
|
|
||||||
|
|
||||||
quorum_refresh_flags(bs);
|
quorum_refresh_flags(bs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,6 +406,13 @@ struct BlockDriver {
|
||||||
void GRAPH_WRLOCK_PTR (*bdrv_add_child)(
|
void GRAPH_WRLOCK_PTR (*bdrv_add_child)(
|
||||||
BlockDriverState *parent, BlockDriverState *child, Error **errp);
|
BlockDriverState *parent, BlockDriverState *child, Error **errp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hot remove a BDS's child. Used in combination with bdrv_add_child, so the
|
||||||
|
* user can take a child offline when it is broken and take a new child
|
||||||
|
* online.
|
||||||
|
*
|
||||||
|
* All block nodes must be drained.
|
||||||
|
*/
|
||||||
void GRAPH_WRLOCK_PTR (*bdrv_del_child)(
|
void GRAPH_WRLOCK_PTR (*bdrv_del_child)(
|
||||||
BlockDriverState *parent, BdrvChild *child, Error **errp);
|
BlockDriverState *parent, BdrvChild *child, Error **errp);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue