diff --git a/fs/io_uring.c b/fs/io_uring.c index 10fd24ec341b2c59575898529bf6972047a2f231..e28eedab5365f42239330c4ed59ad0b9478369d9 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6802,8 +6802,16 @@ static int io_sq_thread(void *data) * kthread parking. This synchronizes the thread vs users, * the users are synchronized on the sqd->ctx_lock. */ - if (kthread_should_park()) + if (kthread_should_park()) { kthread_parkme(); + /* + * When sq thread is unparked, in case the previous park operation + * comes from io_put_sq_data(), which means that sq thread is going + * to be stopped, so here needs to have a check. + */ + if (kthread_should_stop()) + break; + } if (unlikely(!list_empty(&sqd->ctx_new_list))) io_sqd_init_new(sqd);