Skip to content

Commit 8629397

Browse files
committed
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: 37d1e2e ("io_uring: move SQPOLL thread io-wq forked worker") Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent ba50a03 commit 8629397

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

fs/io_uring.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6783,10 +6783,13 @@ static int io_sq_thread(void *data)
67836783

67846784
io_run_task_work();
67856785

6786+
if (io_sq_thread_should_park(sqd))
6787+
io_sq_thread_parkme(sqd);
6788+
67866789
/*
67876790
* Clear thread under lock so that concurrent parks work correctly
67886791
*/
6789-
complete_all(&sqd->completion);
6792+
complete(&sqd->completion);
67906793
mutex_lock(&sqd->lock);
67916794
sqd->thread = NULL;
67926795
list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) {

0 commit comments

Comments
 (0)