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

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

The function bdrv_attach_child() runs under the graph lock, so it is
not allowed to drain. It is called by:
1. replication_start()
2. quorum_add_child()
3. bdrv_open_child_common()
4. Throughout test-bdrv-graph-mod.c and test-bdrv-drain.c unit tests.

In all callers, a drained section is introduced.

The function quorum_add_child() runs under the graph lock, so it is
not actually allowed to drain. This will be addressed by the following
commit.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20250530151125.955508-14-f.ebner@proxmox.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c
block/quorum.c
block/replication.c
tests/unit/test-bdrv-drain.c
tests/unit/test-bdrv-graph-mod.c