diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2022-11-17 19:40:15 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-11-17 20:33:33 +0100 |
commit | 539bcb57da2f58886d7d5c17134236b0ec9cd15d (patch) | |
tree | 5ecb26a02405a4a11e15704798d203e36743e297 | |
parent | io_uring: update res mask in io_poll_check_events (diff) | |
download | linux-539bcb57da2f58886d7d5c17134236b0ec9cd15d.tar.xz linux-539bcb57da2f58886d7d5c17134236b0ec9cd15d.zip |
io_uring: fix tw losing poll events
We may never try to process a poll wake and its mask if there was
multiple wake ups racing for queueing up a tw. Force
io_poll_check_events() to update the mask by 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/00344d60f8b18907171178d7cf598de71d127b0b.1668710222.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r-- | io_uring/poll.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/io_uring/poll.c b/io_uring/poll.c index 90920abf91ff..c34019b18211 100644 --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -228,6 +228,13 @@ static int io_poll_check_events(struct io_kiocb *req, bool *locked) return IOU_POLL_DONE; if (v & IO_POLL_CANCEL_FLAG) return -ECANCELED; + /* + * cqe.res contains only events of the first wake up + * and all others are be lost. Redo vfs_poll() to get + * up to date state. + */ + if ((v & IO_POLL_REF_MASK) != 1) + req->cqe.res = 0; /* the mask was stashed in __io_poll_execute */ if (!req->cqe.res) { |