summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-12-02 14:27:11 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-12-08 11:28:43 +0100
commit62321dc7b08103259b19a82089fc49f66f1e4ce6 (patch)
treea00f766ff035013aa150d29816b3eb065dc4be90
parent417d5ea6e735e5d88ffb6c436cf2938f3f476dd1 (diff)
io_uring: update res mask in io_poll_check_events
[ upstream commit b98186aee22fa593bc8c6b2c5d839c2ee518bc8c ] 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@vger.kernel.org Fixes: aa43477b04025 ("io_uring: poll rework") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/2dac97e8f691231049cb259c4ae57e79e40b537c.1668710222.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/io_uring.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index b8ae64df90e3..2ba42e6e0881 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5464,6 +5464,9 @@ static int io_poll_check_events(struct io_kiocb *req)
return 0;
}
+ /* force the next iteration to vfs_poll() */
+ req->result = 0;
+
/*
* Release all references, retry if someone tried to restart
* task_work while we were executing it.