Skip to content

Commit 005308f

Browse files
committed
io_uring/poll: clear single/double poll flags on poll arming
Unless we have at least one entry queued, then don't call into io_poll_remove_entries(). Normally this isn't possible, but if we retry poll then we can have ->nr_entries cleared again as we're setting it up. If this happens for a poll retry, then we'll still have at least REQ_F_SINGLE_POLL set. io_poll_remove_entries() then thinks it has entries to remove. Clear REQ_F_SINGLE_POLL and REQ_F_DOUBLE_POLL unconditionally when arming a poll request. Fixes: c16bda3 ("io_uring/poll: allow some retries for poll triggering spuriously") Cc: [email protected] Reported-by: Pengfei Xu <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 02a4d92 commit 005308f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

io_uring/poll.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags)
726726
apoll = io_req_alloc_apoll(req, issue_flags);
727727
if (!apoll)
728728
return IO_APOLL_ABORTED;
729+
req->flags &= ~(REQ_F_SINGLE_POLL | REQ_F_DOUBLE_POLL);
729730
req->flags |= REQ_F_POLLED;
730731
ipt.pt._qproc = io_async_queue_proc;
731732

0 commit comments

Comments
 (0)