aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-02-26 13:46:49 -0700
committerJens Axboe <axboe@kernel.dk>2021-03-04 06:34:04 -0700
commit8629397e6e2753bb4cc62ba48a12e1d4d912b6a4 (patch)
treeca4c7e7144531e70dd0fd3781430922fcad5bfa0
parentba50a036f23c44608b1d903c34644a1acd5d21fa (diff)
downloadlinux-8629397e6e2753bb4cc62ba48a12e1d4d912b6a4.tar.gz
io_uring: don't use complete_all() on SQPOLL thread exit
We want to reuse this completion, and a single complete should do just fine. Ensure that we park ourselves first if requested, as that is what lead to the initial deadlock in this area. If we've got someone attempting to park us, then we can't proceed without having them finish first. Fixes: 37d1e2e3642e ("io_uring: move SQPOLL thread io-wq forked worker") Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/io_uring.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 9d6696ff5748db..904bf0fecc36a8 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6783,10 +6783,13 @@ static int io_sq_thread(void *data)
io_run_task_work();
+ if (io_sq_thread_should_park(sqd))
+ io_sq_thread_parkme(sqd);
+
/*
* Clear thread under lock so that concurrent parks work correctly
*/
- complete_all(&sqd->completion);
+ complete(&sqd->completion);
mutex_lock(&sqd->lock);
sqd->thread = NULL;
list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) {