Skip to contentSkip to conversation

block: mark aio_poll as non-coroutine

PATCH Applied Paolo Bonzini 3 participants 3 messages Sep 8, 2023 – Sep 19, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: mark aio_poll as non-coroutine

It is forbidden to block on the event loop during a coroutine, as that can cause deadlocks due to recursive locking.

---
 include/block/aio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/block/aio.h +1 -1
index 32042e8905a..f1d0a37d68f 100644
@@ -468,7 +468,7 @@ void aio_dispatch(AioContext *ctx);
  * or more AIO events have completed, to ensure something has moved
  * before returning.
  */
-bool aio_poll(AioContext *ctx, bool blocking);
+bool no_coroutine_fn aio_poll(AioContext *ctx, bool blocking);
 
 /* Register a file descriptor and associated callbacks.  Behaves very similarly
  * to qemu_set_fd_handler.  Unlike qemu_set_fd_handler, these callbacks will
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Paolo Bonzini

It is forbidden to block on the event loop during a coroutine, as that can cause deadlocks due to recursive locking.

---
  include/block/aio.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
include/block/aio.h +0 -0
index 32042e8905a..f1d0a37d68f 100644

include/block/aio.h void aio_dispatch(AioContext *ctx); · line 474

Quoted 8 lines
include/block/aio.h +1 -1
@@ -468,7 +468,7 @@ void aio_dispatch(AioContext *ctx);
   * or more AIO events have completed, to ensure something has moved
   * before returning.
   */
-bool aio_poll(AioContext *ctx, bool blocking);
+bool no_coroutine_fn aio_poll(AioContext *ctx, bool blocking);
 
  /* Register a file descriptor and associated callbacks.  Behaves very similarly
   * to qemu_set_fd_handler.  Unlike qemu_set_fd_handler, these callbacks will

While this is a no-op change for the code and trivial syntactically, I'm skeptical it should go through trivial-patches@.

/mjt