Skip to content

Commit

Permalink
aio-posix: fix test-aio /aio/event/wait with fdmon-io_uring
Browse files Browse the repository at this point in the history
When a file descriptor becomes ready we must re-arm POLL_ADD.  This is
done by adding an sqe to the io_uring sq ring.  The ->need_wait()
function wasn't taking pending sqes into account and therefore
io_uring_submit_and_wait() was not being called.  Polling for cqes
failed to detect fd readiness since we hadn't submitted the sqe to
io_uring.

This patch fixes the following tests/test-aio -p /aio/event/wait
failure:

  ok 11 /aio/event/wait
  **
  ERROR:tests/test-aio.c:374:test_flush_event_notifier: assertion failed: (aio_poll(ctx, false))

Reported-by: Cole Robinson <[email protected]>
Reviewed-by: Stefano Garzarella <[email protected]>
Tested-by: Cole Robinson <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Message-id: [email protected]
Fixes: 73fd282
       ("aio-posix: add io_uring fd monitoring implementation")
Signed-off-by: Stefan Hajnoczi <[email protected]>
  • Loading branch information
stefanhaRH committed Apr 3, 2020
1 parent 5142ca0 commit ae60ab7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion util/fdmon-io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,12 @@ static bool fdmon_io_uring_need_wait(AioContext *ctx)
return true;
}

/* Do we need to submit new io_uring sqes? */
/* Are there pending sqes to submit? */
if (io_uring_sq_ready(&ctx->fdmon_io_uring)) {
return true;
}

/* Do we need to process AioHandlers for io_uring changes? */
if (!QSLIST_EMPTY_RCU(&ctx->submit_list)) {
return true;
}
Expand Down

0 comments on commit ae60ab7

Please sign in to comment.