* FAILED: patch "[PATCH] io_uring: find and cancel head link async work on files exit" failed to apply to 5.7-stable tree
@ 2020-08-23 12:16 gregkh
2020-08-23 13:48 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: gregkh @ 2020-08-23 12:16 UTC (permalink / raw)
To: axboe, asml.silence; +Cc: stable
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 <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From b711d4eaf0c408a811311ee3e94d6e9e5a230a9a Mon Sep 17 00:00:00 2001
From: Jens Axboe <axboe@kernel.dk>
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.
Cc: stable@vger.kernel.org
Reported-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/fs/io_uring.c b/fs/io_uring.c
index dc506b75659c..346a3eb84785 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -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);
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: FAILED: patch "[PATCH] io_uring: find and cancel head link async work on files exit" failed to apply to 5.7-stable tree
2020-08-23 12:16 FAILED: patch "[PATCH] io_uring: find and cancel head link async work on files exit" failed to apply to 5.7-stable tree gregkh
@ 2020-08-23 13:48 ` Jens Axboe
2020-08-23 20:04 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2020-08-23 13:48 UTC (permalink / raw)
To: gregkh, asml.silence; +Cc: stable
On 8/23/20 6:16 AM, gregkh@linuxfoundation.org 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 <stable@vger.kernel.org>.
This needs this one backported:
commit 4f26bda1522c35d2701fc219368c7101c17005c1
Author: Pavel Begunkov <asml.silence@gmail.com>
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.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: FAILED: patch "[PATCH] io_uring: find and cancel head link async work on files exit" failed to apply to 5.7-stable tree
2020-08-23 13:48 ` Jens Axboe
@ 2020-08-23 20:04 ` Jens Axboe
2020-08-23 20:43 ` Sasha Levin
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2020-08-23 20:04 UTC (permalink / raw)
To: gregkh, asml.silence; +Cc: stable
On 8/23/20 7:48 AM, Jens Axboe wrote:
> On 8/23/20 6:16 AM, gregkh@linuxfoundation.org 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 <stable@vger.kernel.org>.
>
> This needs this one backported:
>
> commit 4f26bda1522c35d2701fc219368c7101c17005c1
> Author: Pavel Begunkov <asml.silence@gmail.com>
> 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.
OK, you just need to cherry pick this one:
commit f4c2665e33f48904f2766d644df33fb3fd54b5ec
Author: Pavel Begunkov <asml.silence@gmail.com>
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 <asml.silence@gmail.com>
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 <asml.silence@gmail.com>
Date: Mon Jun 15 10:24:04 2020 +0300
io_uring: cancel all task's requests on exit
Thanks!
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: FAILED: patch "[PATCH] io_uring: find and cancel head link async work on files exit" failed to apply to 5.7-stable tree
2020-08-23 20:04 ` Jens Axboe
@ 2020-08-23 20:43 ` Sasha Levin
2020-08-23 20:57 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2020-08-23 20:43 UTC (permalink / raw)
To: Jens Axboe; +Cc: gregkh, asml.silence, stable
On Sun, Aug 23, 2020 at 02:04:25PM -0600, Jens Axboe wrote:
>On 8/23/20 7:48 AM, Jens Axboe wrote:
>> On 8/23/20 6:16 AM, gregkh@linuxfoundation.org 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 <stable@vger.kernel.org>.
>>
>> This needs this one backported:
>>
>> commit 4f26bda1522c35d2701fc219368c7101c17005c1
>> Author: Pavel Begunkov <asml.silence@gmail.com>
>> 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.
>
>OK, you just need to cherry pick this one:
>
>commit f4c2665e33f48904f2766d644df33fb3fd54b5ec
>Author: Pavel Begunkov <asml.silence@gmail.com>
>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 <asml.silence@gmail.com>
>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 <asml.silence@gmail.com>
>Date: Mon Jun 15 10:24:04 2020 +0300
>
> io_uring: cancel all task's requests on exit
Done, thanks!
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: FAILED: patch "[PATCH] io_uring: find and cancel head link async work on files exit" failed to apply to 5.7-stable tree
2020-08-23 20:43 ` Sasha Levin
@ 2020-08-23 20:57 ` Jens Axboe
0 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2020-08-23 20:57 UTC (permalink / raw)
To: Sasha Levin; +Cc: gregkh, asml.silence, stable
On 8/23/20 2:43 PM, Sasha Levin wrote:
> On Sun, Aug 23, 2020 at 02:04:25PM -0600, Jens Axboe wrote:
>> On 8/23/20 7:48 AM, Jens Axboe wrote:
>>> On 8/23/20 6:16 AM, gregkh@linuxfoundation.org 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 <stable@vger.kernel.org>.
>>>
>>> This needs this one backported:
>>>
>>> commit 4f26bda1522c35d2701fc219368c7101c17005c1
>>> Author: Pavel Begunkov <asml.silence@gmail.com>
>>> 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.
>>
>> OK, you just need to cherry pick this one:
>>
>> commit f4c2665e33f48904f2766d644df33fb3fd54b5ec
>> Author: Pavel Begunkov <asml.silence@gmail.com>
>> 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 <asml.silence@gmail.com>
>> 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 <asml.silence@gmail.com>
>> Date: Mon Jun 15 10:24:04 2020 +0300
>>
>> io_uring: cancel all task's requests on exit
>
> Done, thanks!
Thanks Sasha!
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-08-23 20:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-23 12:16 FAILED: patch "[PATCH] io_uring: find and cancel head link async work on files exit" failed to apply to 5.7-stable tree gregkh
2020-08-23 13:48 ` Jens Axboe
2020-08-23 20:04 ` Jens Axboe
2020-08-23 20:43 ` Sasha Levin
2020-08-23 20:57 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.