Skip to content

Commit

Permalink
io_uring: fix missing set of EPOLLONESHOT for CQ ring overflow
Browse files Browse the repository at this point in the history
[ Upstream commit a62682f ]

We should set EPOLLONESHOT if cqring_fill_event() returns false since
io_poll_add() decides to put req or not by it.

Fixes: 5082620 ("io_uring: terminate multishot poll for CQ ring overflow")
Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
Link: https://lore.kernel.org/r/20210922101238.7177-3-haoxu@linux.alibaba.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Hao Xu authored and gregkh committed Sep 30, 2021
1 parent 4e81f12 commit 24d38dc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/io_uring.c
Expand Up @@ -4968,8 +4968,10 @@ static bool io_poll_complete(struct io_kiocb *req, __poll_t mask)
}
if (req->poll.events & EPOLLONESHOT)
flags = 0;
if (!io_cqring_fill_event(ctx, req->user_data, error, flags))
if (!io_cqring_fill_event(ctx, req->user_data, error, flags)) {
req->poll.events |= EPOLLONESHOT;
flags = 0;
}
if (flags & IORING_CQE_F_MORE)
ctx->cq_extra++;

Expand Down

0 comments on commit 24d38dc

Please sign in to comment.