diff --git a/patches.kernel.org/6.2.12-029-io_uring-complete-request-via-task-work-in-cas.patch b/patches.kernel.org/6.2.12-029-io_uring-complete-request-via-task-work-in-cas.patch new file mode 100644 index 0000000..79945f6 --- /dev/null +++ b/patches.kernel.org/6.2.12-029-io_uring-complete-request-via-task-work-in-cas.patch @@ -0,0 +1,51 @@ +From: Ming Lei +Date: Fri, 14 Apr 2023 15:53:13 +0800 +Subject: [PATCH] io_uring: complete request via task work in case of + DEFER_TASKRUN +References: bsc#1012628 +Patch-mainline: 6.2.12 +Git-commit: 860e1c7f8b0b43fbf91b4d689adfaa13adb89452 + +commit 860e1c7f8b0b43fbf91b4d689adfaa13adb89452 upstream. + +So far io_req_complete_post() only covers DEFER_TASKRUN by completing +request via task work when the request is completed from IOWQ. + +However, uring command could be completed from any context, and if io +uring is setup with DEFER_TASKRUN, the command is required to be +completed from current context, otherwise wait on IORING_ENTER_GETEVENTS +can't be wakeup, and may hang forever. + +The issue can be observed on removing ublk device, but turns out it is +one generic issue for uring command & DEFER_TASKRUN, so solve it in +io_uring core code. + +Fixes: e6aeb2721d3b ("io_uring: complete all requests in task context") +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/linux-block/b3fc9991-4c53-9218-a8cc-5b4dd3952108@kernel.dk/ +Reported-by: Jens Axboe +Cc: Kanchan Joshi +Signed-off-by: Ming Lei +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Jiri Slaby +--- + io_uring/io_uring.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c +index add5cff7..14d4fa64 100644 +--- a/io_uring/io_uring.c ++++ b/io_uring/io_uring.c +@@ -962,7 +962,7 @@ static void __io_req_complete_post(struct io_kiocb *req) + + void io_req_complete_post(struct io_kiocb *req, unsigned issue_flags) + { +- if (req->ctx->task_complete && (issue_flags & IO_URING_F_IOWQ)) { ++ if (req->ctx->task_complete && req->ctx->submitter_task != current) { + req->io_task_work.func = io_req_task_complete; + io_req_task_work_add(req); + } else if (!(issue_flags & IO_URING_F_UNLOCKED) || +-- +2.35.3 + diff --git a/series.conf b/series.conf index 39153c8..b3c7ad5 100644 --- a/series.conf +++ b/series.conf @@ -2256,6 +2256,7 @@ patches.kernel.org/6.2.12-026-fbcon-Fix-error-paths-in-set_con2fb_map.patch patches.kernel.org/6.2.12-027-fbcon-set_con2fb_map-needs-to-set-con2fb_map.patch patches.kernel.org/6.2.12-028-drm-i915-dsi-fix-DSS-CTL-register-offsets-for-.patch + patches.kernel.org/6.2.12-029-io_uring-complete-request-via-task-work-in-cas.patch ######################################################## # Build fixes that apply to the vanilla kernel too.