Skip to content

Commit

Permalink
io_uring: flush overflowed CQ events in the io_uring_poll()
Browse files Browse the repository at this point in the history
In io_uring_poll() we must flush overflowed CQ events before to
check if there are CQ events available, to avoid missing events.

We call the io_cqring_events() that checks and flushes any overflow
and returns the number of CQ events available.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Stefano Garzarella authored and Jens Axboe committed Feb 8, 2020
1 parent cf3040c commit 63e5d81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -6283,7 +6283,7 @@ static __poll_t io_uring_poll(struct file *file, poll_table *wait)
if (READ_ONCE(ctx->rings->sq.tail) - ctx->cached_sq_head !=
ctx->rings->sq_ring_entries)
mask |= EPOLLOUT | EPOLLWRNORM;
if (READ_ONCE(ctx->rings->cq.head) != ctx->cached_cq_tail)
if (io_cqring_events(ctx, false))
mask |= EPOLLIN | EPOLLRDNORM;

return mask;
Expand Down

0 comments on commit 63e5d81

Please sign in to comment.