This is a note to let you know that I've just added the patch titled io_uring: update res mask in io_poll_check_events to the 6.0-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-update-res-mask-in-io_poll_check_events.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From b98186aee22fa593bc8c6b2c5d839c2ee518bc8c Mon Sep 17 00:00:00 2001 From: Pavel Begunkov <asml.silence@xxxxxxxxx> Date: Thu, 17 Nov 2022 18:40:14 +0000 Subject: io_uring: update res mask in io_poll_check_events From: Pavel Begunkov <asml.silence@xxxxxxxxx> commit b98186aee22fa593bc8c6b2c5d839c2ee518bc8c upstream. When io_poll_check_events() collides with someone attempting to queue a task work, it'll spin for one more time. However, it'll continue to use the mask from the first iteration instead of updating it. For example, if the first wake up was a EPOLLIN and the second EPOLLOUT, the userspace will not get EPOLLOUT in time. Clear the mask for all subsequent iterations to force vfs_poll(). Cc: stable@xxxxxxxxxxxxxxx Fixes: aa43477b04025 ("io_uring: poll rework") Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> Link: https://lore.kernel.org/r/2dac97e8f691231049cb259c4ae57e79e40b537c.1668710222.git.asml.silence@xxxxxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- io_uring/poll.c | 3 +++ 1 file changed, 3 insertions(+) --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -256,6 +256,9 @@ static int io_poll_check_events(struct i return ret; } + /* force the next iteration to vfs_poll() */ + req->cqe.res = 0; + /* * Release all references, retry if someone tried to restart * task_work while we were executing it. Patches currently in stable-queue which might be from asml.silence@xxxxxxxxx are queue-6.0/io_uring-update-res-mask-in-io_poll_check_events.patch queue-6.0/io_uring-poll-fix-double-poll-req-flags-races.patch