]> git.ipfire.org Git - thirdparty/qemu.git/commit
block: move drain outside of bdrv_root_unref_child()
authorFiona Ebner <f.ebner@proxmox.com>
Fri, 30 May 2025 15:10:52 +0000 (17:10 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 4 Jun 2025 16:16:34 +0000 (18:16 +0200)
commitb13f54654546cbc0661d3fe9d25f7543535c2bee
tree92fce263924286d04bce530069f7043ae83e114d
parent0414930d3adfa89299eaea5ce92accab15d9fba5
block: move drain outside of bdrv_root_unref_child()

This is part of resolving the deadlock mentioned in commit "block:
move draining out of bdrv_change_aio_context() and mark GRAPH_RDLOCK".

bdrv_root_unref_child() is called by:
1. blk_remove_bs(), where a drained section is introduced.
2. bdrv_unref_child(), which runs under the graph lock, so the drain
   will be moved further up to its callers.
3. block_job_remove_all_bdrv(), where a drained section is introduced.

For all callers of bdrv_unref_child() and its generated
bdrv_co_unref_child() coroutine variant, a drained section is
introduced, they are not explicilty listed here. The caller
quorum_del_child() holds the graph lock, so it is not actually allowed
to drain. This will be addressed in the next commit.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Message-ID: <20250530151125.955508-16-f.ebner@proxmox.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c
block/blklogwrites.c
block/blkverify.c
block/block-backend.c
block/qcow2.c
block/quorum.c
block/replication.c
block/snapshot.c
block/vmdk.c
blockjob.c
tests/unit/test-bdrv-drain.c