Skip to content

util/aio-posix: fix and clean up poll_ready handling in aio_prepare()

Bin Guo qemu-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2util/aio-posix: fix poll_ready handlers dropped in aio_prepare()util/aio-posix.c+34 -30 replies
2/2util/aio-posix: avoid allocating ready_list in aio_prepare()util/aio-posix.c+6 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] util/aio-posix: fix and clean up poll_ready handling in aio_prepare()

When aio_prepare() calls poll_set_started(..., false) to disable poll mode before handing control to GLib's event loop, the final poll round may mark handlers poll_ready=true and insert them into a local ready_list. That list is discarded when aio_prepare() returns, so those handlers are silently lost until the next GLib iteration.

Patch 1 fixes the bug: aio_pending() is extended to scan poll_aio_handlers for poll_ready nodes so GLib's check phase reports pending work, and aio_dispatch() is taught to collect those nodes before dispatching, ensuring they are executed in the same cycle.

Patch 2 is a follow-up clean-up: now that poll_ready nodes are handled via aio_pending()/aio_dispatch(), the local ready_list in aio_prepare() serves no purpose. Pass NULL to poll_set_started() and teach it to set poll_ready=true directly, eliminating the unnecessary list operations.

Bin Guo (2):
util/aio-posix: fix poll_ready handlers dropped in aio_prepare() util/aio-posix: avoid allocating ready_list in aio_prepare()

 util/aio-posix.c | 47 ++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 40 insertions(+), 7 deletions(-)
Signature · 1 line
2.50.1 (Apple Git-155)