diff --git a/fs/io_uring.c b/fs/io_uring.c index 35bc955f32460f77973c43ca191c75339fba456e..b7e7670382b34355352a46418237750bf19fbe9c 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2992,12 +2992,7 @@ static int io_issue_sqe(struct io_kiocb *req, struct io_kiocb **nxt, if (req->result == -EAGAIN) return -EAGAIN; - /* workqueue context doesn't hold uring_lock, grab it now */ - if (req->in_async) - mutex_lock(&ctx->uring_lock); io_iopoll_req_issued(req); - if (req->in_async) - mutex_unlock(&ctx->uring_lock); } return 0; @@ -3642,7 +3637,9 @@ static int io_sq_thread(void *data) } to_submit = min(to_submit, ctx->sq_entries); + mutex_lock(&ctx->uring_lock); ret = io_submit_sqes(ctx, to_submit, NULL, -1, &cur_mm, true); + mutex_unlock(&ctx->uring_lock); timeout = jiffies + ctx->sq_thread_idle; }