test-bdrv-drain: Don't call bdrv_graph_wrlock() in coroutine context
commit903df115aaa5b9455ffde2894002f3f4820868bd
authorKevin Wolf <kwolf@redhat.com>
Fri, 29 Sep 2023 14:51:36 +0000 (29 16:51 +0200)
committerKevin Wolf <kwolf@redhat.com>
Thu, 12 Oct 2023 14:31:33 +0000 (12 16:31 +0200)
treea0fce202e653c57cefa0cd3bec39b56e74a3f2ff
parentcc323997731bb1c2a9896fcca668b57d82d62153
test-bdrv-drain: Don't call bdrv_graph_wrlock() in coroutine context

AIO callbacks are effectively coroutine_mixed_fn. If AIO requests don't
return immediately, their callback is called from the request coroutine.
This means that in AIO callbacks, we can't call no_coroutine_fns such as
bdrv_graph_wrlock(). Unfortunately test-bdrv-drain does so.

Change the test to use a BH to drop out of coroutine context, and add
coroutine_mixed_fn and no_coroutine_fn markers to clarify the context
each function runs in.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20230929145157.45443-2-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
tests/unit/test-bdrv-drain.c