Skip to content

Commit 4ea672a

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix ltimeout unprep
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: 906c6ca ("io_uring: optimise io_prep_linked_timeout()") Reported-by: Beld Zhang <[email protected]> Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/51b8e2bfc4bea8ee625cf2ba62b2a350cc9be031.1634719585.git.asml.silence@gmail.com Link: axboe/liburing#460 Reported-by: Beld Zhang <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent e139a1e commit 4ea672a

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

fs/io_uring.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,11 +1370,6 @@ static void io_req_track_inflight(struct io_kiocb *req)
13701370
}
13711371
}
13721372

1373-
static inline void io_unprep_linked_timeout(struct io_kiocb *req)
1374-
{
1375-
req->flags &= ~REQ_F_LINK_TIMEOUT;
1376-
}
1377-
13781373
static struct io_kiocb *__io_prep_linked_timeout(struct io_kiocb *req)
13791374
{
13801375
if (WARN_ON_ONCE(!req->link))
@@ -6985,7 +6980,7 @@ static void __io_queue_sqe(struct io_kiocb *req)
69856980
switch (io_arm_poll_handler(req)) {
69866981
case IO_APOLL_READY:
69876982
if (linked_timeout)
6988-
io_unprep_linked_timeout(req);
6983+
io_queue_linked_timeout(linked_timeout);
69896984
goto issue_sqe;
69906985
case IO_APOLL_ABORTED:
69916986
/*

0 commit comments

Comments
 (0)