aboutsummaryrefslogtreecommitdiff
path: root/block/graph-lock.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-09-29 16:51:57 +0200
committerKevin Wolf <kwolf@redhat.com>2023-10-12 16:31:33 +0200
commite6e964b8b021446c8d3d1f91c0208f653e9ec92c (patch)
treeb9c929a6359b628c374bb7e71bd9b8b1517e16b5 /block/graph-lock.c
parent680e0cc40c5830ebcbfa0bce99bf932e1a4cf6c6 (diff)
downloadqemu-e6e964b8b021446c8d3d1f91c0208f653e9ec92c.zip
qemu-e6e964b8b021446c8d3d1f91c0208f653e9ec92c.tar.gz
qemu-e6e964b8b021446c8d3d1f91c0208f653e9ec92c.tar.bz2
block: Add assertion for bdrv_graph_wrlock()
bdrv_graph_wrlock() can't run in a coroutine (because it polls) and requires holding the BQL. We already have GLOBAL_STATE_CODE() to assert the latter. Assert the former as well and add a no_coroutine_fn marker. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20230929145157.45443-23-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/graph-lock.c')
-rw-r--r--block/graph-lock.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/graph-lock.c b/block/graph-lock.c
index 58a7990..e5525ee 100644
--- a/block/graph-lock.c
+++ b/block/graph-lock.c
@@ -106,12 +106,13 @@ static uint32_t reader_count(void)
return rd;
}
-void bdrv_graph_wrlock(BlockDriverState *bs)
+void no_coroutine_fn bdrv_graph_wrlock(BlockDriverState *bs)
{
AioContext *ctx = NULL;
GLOBAL_STATE_CODE();
assert(!qatomic_read(&has_writer));
+ assert(!qemu_in_coroutine());
/*
* Release only non-mainloop AioContext. The mainloop often relies on the