io_req_task_submit() might be called for IOPOLL, do the fail path under uring_lock to comply with IOPOLL synchronisation based solely on it. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- fs/io_uring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 9c554adf3993..1c32d4700caf 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2143,14 +2143,14 @@ static void __io_req_task_submit(struct io_kiocb *req) { struct io_ring_ctx *ctx = req->ctx; + mutex_lock(&ctx->uring_lock); if (!__io_sq_thread_acquire_mm(ctx) && !__io_sq_thread_acquire_files(ctx)) { - mutex_lock(&ctx->uring_lock); __io_queue_sqe(req, NULL); - mutex_unlock(&ctx->uring_lock); } else { __io_req_task_cancel(req, -EFAULT); } + mutex_unlock(&ctx->uring_lock); } static void io_req_task_submit(struct callback_head *cb) -- 2.24.0