This is a note to let you know that I've just added the patch titled io_uring: fix missing set of EPOLLONESHOT for CQ ring overflow to the 5.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: io_uring-fix-missing-set-of-epolloneshot-for-cq-ring.patch and it can be found in the queue-5.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 094285a50f040bc69e8c074f30cf7459026bde1e Author: Hao Xu <haoxu@xxxxxxxxxxxxxxxxx> Date: Wed Sep 22 18:12:37 2021 +0800 io_uring: fix missing set of EPOLLONESHOT for CQ ring overflow [ Upstream commit a62682f92eedb41c1cd8290fa875a4b85624fb9a ] We should set EPOLLONESHOT if cqring_fill_event() returns false since io_poll_add() decides to put req or not by it. Fixes: 5082620fb2ca ("io_uring: terminate multishot poll for CQ ring overflow") Signed-off-by: Hao Xu <haoxu@xxxxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20210922101238.7177-3-haoxu@xxxxxxxxxxxxxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/io_uring.c b/fs/io_uring.c index 27a1c813f1e1..739e58ccc982 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -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++;