[PATCH v3 16/24] block: move drain outside of quorum_del_child()

Fiona Ebner posted 24 patches 5 months, 3 weeks ago
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, John Snow <jsnow@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>, Ari Sundholm <ari@tuxera.com>, Stefan Hajnoczi <stefanha@redhat.com>, Fam Zheng <fam@euphon.net>, Alberto Garcia <berto@igalia.com>, Wen Congyang <wencongyang2@huawei.com>, Xie Changlong <xiechanglong.d@gmail.com>
There is a newer version of this series
[PATCH v3 16/24] block: move drain outside of quorum_del_child()
Posted by Fiona Ebner 5 months, 3 weeks ago
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>
---

No changes in v3.

 block/quorum.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/block/quorum.c b/block/quorum.c
index 81407a38ee..cc3bc5f4e7 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -1147,9 +1147,7 @@ quorum_del_child(BlockDriverState *bs, BdrvChild *child, Error **errp)
             (s->num_children - i - 1) * sizeof(BdrvChild *));
     s->children = g_renew(BdrvChild *, s->children, --s->num_children);
 
-    bdrv_drain_all_begin();
     bdrv_unref_child(bs, child);
-    bdrv_drain_all_end();
 
     quorum_refresh_flags(bs);
 }
-- 
2.39.5
Re: [PATCH v3 16/24] block: move drain outside of quorum_del_child()
Posted by Kevin Wolf 5 months, 3 weeks ago
Am 26.05.2025 um 15:21 hat Fiona Ebner geschrieben:
> 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>

With the usual comments added:

Reviewed-by: Kevin Wolf <kwolf@redhat.com>