graph-lock: Unlock the AioContext while polling
commit31b2ddfea304afc498aca8cac171020ef33eb89b
authorKevin Wolf <kwolf@redhat.com>
Mon, 5 Jun 2023 08:57:10 +0000 (5 10:57 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 28 Jun 2023 06:46:23 +0000 (28 08:46 +0200)
tree3d0f42e0e2539c0f354169ffc2678456e8653190
parent22dd9405446f5301f32be4f9e88db6d9b582fd03
graph-lock: Unlock the AioContext while polling

If the caller keeps the AioContext lock for a block node in an iothread,
polling in bdrv_graph_wrlock() deadlocks if the condition isn't
fulfilled immediately.

Now that all callers make sure to actually have the AioContext locked
when they call bdrv_replace_child_noperm() like they should, we can
change bdrv_graph_wrlock() to take a BlockDriverState whose AioContext
lock the caller holds (NULL if it doesn't) and unlock it temporarily
while polling.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20230605085711.21261-11-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c
block/graph-lock.c
include/block/graph-lock.h