This is a note to let you know that I've just added the patch titled io_uring: put link timeout req consistently to the 5.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: io_uring-put-link-timeout-req-consistently.patch and it can be found in the queue-5.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From df9727affa058f4f18e388b30247650f8ae13cd8 Mon Sep 17 00:00:00 2001 From: Pavel Begunkov <asml.silence@xxxxxxxxx> Date: Thu, 1 Apr 2021 15:43:59 +0100 Subject: io_uring: put link timeout req consistently From: Pavel Begunkov <asml.silence@xxxxxxxxx> commit df9727affa058f4f18e388b30247650f8ae13cd8 upstream. Don't put linked timeout req in io_async_find_and_cancel() but do it in io_link_timeout_fn(), so we have only one point for that and won't have to do it differently as it's now (put vs put_deferred). Btw, improve a bit io_async_find_and_cancel()'s locking. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> Link: https://lore.kernel.org/r/d75b70957f245275ab7cba83e0ac9c1b86aae78a.1617287883.git.asml.silence@xxxxxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/io_uring.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5727,12 +5727,9 @@ static void io_async_find_and_cancel(str int ret; ret = io_async_cancel_one(req->task->io_uring, sqe_addr, ctx); - if (ret != -ENOENT) { - spin_lock_irqsave(&ctx->completion_lock, flags); - goto done; - } - spin_lock_irqsave(&ctx->completion_lock, flags); + if (ret != -ENOENT) + goto done; ret = io_timeout_cancel(ctx, sqe_addr); if (ret != -ENOENT) goto done; @@ -5747,7 +5744,6 @@ done: if (ret < 0) req_set_fail_links(req); - io_put_req(req); } static int io_async_cancel_prep(struct io_kiocb *req, @@ -6310,8 +6306,8 @@ static enum hrtimer_restart io_link_time io_put_req_deferred(req, 1); } else { io_req_complete_post(req, -ETIME, 0); - io_put_req_deferred(req, 1); } + io_put_req_deferred(req, 1); return HRTIMER_NORESTART; } Patches currently in stable-queue which might be from asml.silence@xxxxxxxxx are queue-5.12/io_uring-fix-link-timeout-refs.patch queue-5.12/io_uring-use-right-task-for-exiting-checks.patch queue-5.12/io_uring-put-link-timeout-req-consistently.patch