]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0007-io_uring-don-t-block-level-reissue-off-completion-pa.patch
ec9ce571e6b1526a35138984cadb51dff6eb3673
[pve-kernel.git] / patches / kernel / 0007-io_uring-don-t-block-level-reissue-off-completion-pa.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Fabian Ebner <f.ebner@proxmox.com>
3 Date: Wed, 28 Jul 2021 08:55:31 +0200
4 Subject: [PATCH] io_uring: don't block level reissue off completion path
5
6 Some setups, like SCSI, can throw spurious -EAGAIN off the softirq
7 completion path. Normally we expect this to happen inline as part
8 of submission, but apparently SCSI has a weird corner case where it
9 can happen as part of normal completions.
10
11 This should be solved by having the -EAGAIN bubble back up the stack
12 as part of submission, but previous attempts at this failed and we're
13 not just quite there yet. Instead we currently use REQ_F_REISSUE to
14 handle this case.
15
16 For now, catch it in io_rw_should_reissue() and prevent a reissue
17 from a bogus path.
18
19 Upstream mail:
20 https://lore.kernel.org/io-uring/20210727165811.284510-3-axboe@kernel.dk/T/#u
21
22 Originally-by: Jens Axboe <axboe@kernel.dk>
23 [backport]
24 Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
25 ---
26 fs/io_uring.c | 7 +++++++
27 1 file changed, 7 insertions(+)
28
29 diff --git a/fs/io_uring.c b/fs/io_uring.c
30 index 2b86b413641a..11f615033c70 100644
31 --- a/fs/io_uring.c
32 +++ b/fs/io_uring.c
33 @@ -2731,6 +2731,13 @@ static bool io_rw_reissue(struct io_kiocb *req, long res)
34 if (percpu_ref_is_dying(&req->ctx->refs))
35 return false;
36
37 + /*
38 + * Play it safe and assume not safe to re-import and reissue if we're
39 + * not in the original thread group (or in task context).
40 + */
41 + if (!same_thread_group(req->task, current) || !in_task())
42 + return false;
43 +
44 lockdep_assert_held(&req->ctx->uring_lock);
45
46 ret = io_sq_thread_acquire_mm_files(req->ctx, req);
47 --
48 2.30.2
49