FAILED: patch "[PATCH] io_uring: find and cancel head link async work on files exit" failed to apply to 5.7-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.7-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From b711d4eaf0c408a811311ee3e94d6e9e5a230a9a Mon Sep 17 00:00:00 2001
From: Jens Axboe <[email protected]>
Date: Sun, 16 Aug 2020 08:23:05 -0700
Subject: [PATCH] io_uring: find and cancel head link async work on files exit
Commit f254ac04c874 ("io_uring: enable lookup of links holding inflight files") only handled 2 out of the three head link cases we have, we also need to lookup and cancel work that is blocked in io-wq if that work has a link that's holding a reference to the files structure.
Put the "cancel head links that hold this request pending" logic into io_attempt_cancel(), which will to through the motions of finding and canceling head links that hold the current inflight files stable request pending.
fs/io_uring.c +29 -4
@@ -8063,6 +8063,33 @@ static bool io_timeout_remove_link(struct io_ring_ctx *ctx,return found; } +static bool io_cancel_link_cb (struct io_wq_work *work,void *data) +{ + return io_match_link(container_of(work, struct io_kiocb, work), data); +} + +static void io_attempt_cancel (struct io_ring_ctx *ctx,struct io_kiocb *req) +{ +enum io_wq_cancel cret; + +/* cancel this particular work, if it's running */ + cret =io_wq_cancel_work (ctx->io_wq, &req->work); +if (cret !=IO_WQ_CANCEL_NOTFOUND ) +return ; + +/* find links that hold this pending, cancel those */ + cret =io_wq_cancel_cb (ctx->io_wq, io_cancel_link_cb, req, true); +if (cret !=IO_WQ_CANCEL_NOTFOUND ) +return ; + +/* if we have a poll link holding this pending, cancel that */ +if (io_poll_remove_link (ctx, req)) +return ; + +/* final option, timeout link is holding this req pending */ +io_timeout_remove_link (ctx, req); +} +static void io_uring_cancel_files (struct io_ring_ctx *ctx,struct files_struct *files) {
@@ -8116,10 +8143,8 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx,continue ; } }else { -io_wq_cancel_work (ctx->io_wq, &cancel_req->work); -/* could be a link, check and remove if it is */ -if (!io_poll_remove_link (ctx, cancel_req)) -io_timeout_remove_link (ctx, cancel_req); +/* cancel this request, or head link requests */ +io_attempt_cancel (ctx, cancel_req);io_put_req (cancel_req); }
Quoted 5 lines · On 8/23/20 6:16 AM, [email protected] wrote:
The patch below does not apply to the 5.7-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
This needs this one backported:
commit 4f26bda1522c35d2701fc219368c7101c17005c1
Author: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:03 2020 +0300
io-wq: add an option to cancel all matched reqs
I'll take a look later today, unless Pavel beats me to it.
Signature · 1 line
Jens Axboe
Quoted 9 lines · Jens Axboe
Quoted 5 lines · On 8/23/20 6:16 AM, [email protected] wrote:
The patch below does not apply to the 5.7-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.This needs this one backported:
Quoted 7 lines
commit
4f26bda1522c35d2701fc219368c7101c17005c1Author: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:03 2020 +0300io-wq: add an option to cancel all matched reqs
I'll take a look later today, unless Pavel beats me to it.
OK, you just need to cherry pick this one:
commit f4c2665e33f48904f2766d644df33fb3fd54b5ec
Author: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:02 2020 +0300
io-wq: reorder cancellation pending -> running
and then cherry pick this one:
commit 4f26bda1522c35d2701fc219368c7101c17005c1
Author: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:03 2020 +0300
io-wq: add an option to cancel all matched reqs
and then the patch will apply directly without needing any sort of massaging. Looking at that series, please pick this one as well (either at the end, or after the first two):
commit 44e728b8aae0bb6d4229129083974f9dea43f50b
Author: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:04 2020 +0300
io_uring: cancel all task's requests on exit
Thanks!
Signature · 1 line
Jens Axboe
Sasha Levin
maintainerQuoted 38 lines · Jens Axboe
Quoted 9 lines · Jens Axboe
Quoted 5 lines · On 8/23/20 6:16 AM, [email protected] wrote:
The patch below does not apply to the 5.7-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.This needs this one backported:
Quoted 7 lines
commit
4f26bda1522c35d2701fc219368c7101c17005c1Author: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:03 2020 +0300io-wq: add an option to cancel all matched reqs
I'll take a look later today, unless Pavel beats me to it.
OK, you just need to cherry pick this one:
commit
f4c2665e33f48904f2766d644df33fb3fd54b5ecAuthor: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:02 2020 +0300io-wq: reorder cancellation pending -> runningand then cherry pick this one:
commit
4f26bda1522c35d2701fc219368c7101c17005c1Author: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:03 2020 +0300io-wq: add an option to cancel all matched reqs
and then the patch will apply directly without needing any sort of massaging. Looking at that series, please pick this one as well (either at the end, or after the first two):
Quoted 5 lines
commit
44e728b8aae0bb6d4229129083974f9dea43f50bAuthor: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:04 2020 +0300
io_uring: cancel all task's requests on exit
Done, thanks!
Signature · 2 lines
Thanks, Sasha
Quoted 39 lines · Sasha Levin
Quoted 38 lines · Jens Axboe
Quoted 9 lines · Jens Axboe
Quoted 5 lines · On 8/23/20 6:16 AM, [email protected] wrote:
The patch below does not apply to the 5.7-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.This needs this one backported:
Quoted 7 lines
commit
4f26bda1522c35d2701fc219368c7101c17005c1Author: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:03 2020 +0300io-wq: add an option to cancel all matched reqs
I'll take a look later today, unless Pavel beats me to it.
OK, you just need to cherry pick this one:
commit
f4c2665e33f48904f2766d644df33fb3fd54b5ecAuthor: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:02 2020 +0300io-wq: reorder cancellation pending -> runningand then cherry pick this one:
commit
4f26bda1522c35d2701fc219368c7101c17005c1Author: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:03 2020 +0300io-wq: add an option to cancel all matched reqs
and then the patch will apply directly without needing any sort of massaging. Looking at that series, please pick this one as well (either at the end, or after the first two):
Quoted 7 lines
Quoted 5 lines
commit
44e728b8aae0bb6d4229129083974f9dea43f50bAuthor: Pavel Begunkov <[email protected]> Date: Mon Jun 15 10:24:04 2020 +0300
io_uring: cancel all task's requests on exitDone, thanks!
Thanks Sasha!
Signature · 1 line
Jens Axboe