public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH 5.15] io_uring: fix ltimeout unprep
@ 2021-10-20  1:26 Pavel Begunkov
  2021-10-20  1:48 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Begunkov @ 2021-10-20  1:26 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, Pavel Begunkov, Beld Zhang

io_unprep_linked_timeout() is broken, first it needs to return back
REQ_F_ARM_LTIMEOUT, so the linked timeout is enqueued and disarmed. But
now we refcounted it, and linked timeouts may get not executed at all,
leaking a request.

Just kill the unprep optimisation.

Fixes: 906c6caaf5861 ("io_uring: optimise io_prep_linked_timeout()")
Reported-by: Beld Zhang <[email protected]>
Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index c87931d8b503..18de14a9e7a4 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1406,11 +1406,6 @@ static inline void io_req_track_inflight(struct io_kiocb *req)
 	}
 }
 
-static inline void io_unprep_linked_timeout(struct io_kiocb *req)
-{
-	req->flags &= ~REQ_F_LINK_TIMEOUT;
-}
-
 static struct io_kiocb *__io_prep_linked_timeout(struct io_kiocb *req)
 {
 	if (WARN_ON_ONCE(!req->link))
@@ -6892,10 +6887,6 @@ static void io_queue_sqe_arm_apoll(struct io_kiocb *req)
 
 	switch (io_arm_poll_handler(req)) {
 	case IO_APOLL_READY:
-		if (linked_timeout) {
-			io_unprep_linked_timeout(req);
-			linked_timeout = NULL;
-		}
 		io_req_task_queue(req);
 		break;
 	case IO_APOLL_ABORTED:
-- 
2.33.1


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

end of thread, other threads:[~2021-10-20  8:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-20  1:26 [PATCH 5.15] io_uring: fix ltimeout unprep Pavel Begunkov
2021-10-20  1:48 ` Jens Axboe
2021-10-20  8:33   ` Pavel Begunkov
2021-10-20  8:45     ` Pavel Begunkov

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