提交 e5b3fb54 编写于 作者: J Jens Axboe 提交者: Joseph Qi

io_uring: sqthread should grab ctx->uring_lock for submissions

to #26323578

commit 8a4955ff1cca7d4da480774034a16e7c28bafec8 upstream.

We use the mutex to guard against registered file updates, for instance.
Ensure we're safe in accessing that state against concurrent updates.
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 52bb67cc
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册