public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring/poll: clear single/double poll flags on poll arming
@ 2023-03-28  2:08 Jens Axboe
  2023-03-28  2:55 ` Pengfei Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2023-03-28  2:08 UTC (permalink / raw)
  To: io-uring; +Cc: Pengfei Xu

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: c16bda37594f ("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]>

---

diff --git a/io_uring/poll.c b/io_uring/poll.c
index 795facbd0e9f..55306e801081 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -726,6 +726,7 @@ int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags)
 	apoll = io_req_alloc_apoll(req, issue_flags);
 	if (!apoll)
 		return IO_APOLL_ABORTED;
+	req->flags &= ~(REQ_F_SINGLE_POLL | REQ_F_DOUBLE_POLL);
 	req->flags |= REQ_F_POLLED;
 	ipt.pt._qproc = io_async_queue_proc;
 
-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-28 15:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-28  2:08 [PATCH] io_uring/poll: clear single/double poll flags on poll arming Jens Axboe
2023-03-28  2:55 ` Pengfei Xu
2023-03-28 15:03   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox