Commit 9cdbf646 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'io_uring-5.12-2021-04-16' of git://git.kernel.dk/linux-block

Pull io_uring fix from Jens Axboe:
 "Fix for a potential hang at exit with SQPOLL from Pavel"

* tag 'io_uring-5.12-2021-04-16' of git://git.kernel.dk/linux-block:
  io_uring: fix early sqd_list removal sqpoll hangs
parents 15150116 c7d95613
...@@ -6754,6 +6754,9 @@ static int io_sq_thread(void *data) ...@@ -6754,6 +6754,9 @@ static int io_sq_thread(void *data)
current->flags |= PF_NO_SETAFFINITY; current->flags |= PF_NO_SETAFFINITY;
mutex_lock(&sqd->lock); mutex_lock(&sqd->lock);
/* a user may had exited before the thread started */
io_run_task_work_head(&sqd->park_task_work);
while (!test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state)) { while (!test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state)) {
int ret; int ret;
bool cap_entries, sqt_spin, needs_sched; bool cap_entries, sqt_spin, needs_sched;
...@@ -6770,10 +6773,10 @@ static int io_sq_thread(void *data) ...@@ -6770,10 +6773,10 @@ static int io_sq_thread(void *data)
} }
cond_resched(); cond_resched();
mutex_lock(&sqd->lock); mutex_lock(&sqd->lock);
if (did_sig)
break;
io_run_task_work(); io_run_task_work();
io_run_task_work_head(&sqd->park_task_work); io_run_task_work_head(&sqd->park_task_work);
if (did_sig)
break;
timeout = jiffies + sqd->sq_thread_idle; timeout = jiffies + sqd->sq_thread_idle;
continue; continue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment