Skip to content

Commit 539bcb5

Browse files
isilenceaxboe
authored andcommitted
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: aa43477 ("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>
1 parent b98186a commit 539bcb5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

io_uring/poll.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@ static int io_poll_check_events(struct io_kiocb *req, bool *locked)
228228
return IOU_POLL_DONE;
229229
if (v & IO_POLL_CANCEL_FLAG)
230230
return -ECANCELED;
231+
/*
232+
* cqe.res contains only events of the first wake up
233+
* and all others are be lost. Redo vfs_poll() to get
234+
* up to date state.
235+
*/
236+
if ((v & IO_POLL_REF_MASK) != 1)
237+
req->cqe.res = 0;
231238

232239
/* the mask was stashed in __io_poll_execute */
233240
if (!req->cqe.res) {

0 commit comments

Comments
 (0)