提交 109831ff 编写于 作者: P Pavel Begunkov 提交者: Caspar Zhang

io_uring: fix not initialised work->flags

to #29276773

commit 16d598030a37853a7a6b4384cad19c9c0af2f021 upstream.

59960b9deb535 ("io_uring: fix lazy work init") tried to fix missing
io_req_init_async(), but left out work.flags and hash. Do it earlier.

Fixes: 7cdaf587de7c ("io_uring: avoid whole io_wq_work copy for requests completed inline")
Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
上级 589ee219
...@@ -1085,6 +1085,8 @@ static inline void io_prep_async_work(struct io_kiocb *req, ...@@ -1085,6 +1085,8 @@ static inline void io_prep_async_work(struct io_kiocb *req,
{ {
const struct io_op_def *def = &io_op_defs[req->opcode]; const struct io_op_def *def = &io_op_defs[req->opcode];
io_req_init_async(req);
if (req->flags & REQ_F_ISREG) { if (req->flags & REQ_F_ISREG) {
if (def->hash_reg_file) if (def->hash_reg_file)
io_wq_hash_work(&req->work, file_inode(req->file)); io_wq_hash_work(&req->work, file_inode(req->file));
...@@ -1093,7 +1095,6 @@ static inline void io_prep_async_work(struct io_kiocb *req, ...@@ -1093,7 +1095,6 @@ static inline void io_prep_async_work(struct io_kiocb *req,
req->work.flags |= IO_WQ_WORK_UNBOUND; req->work.flags |= IO_WQ_WORK_UNBOUND;
} }
io_req_init_async(req);
io_req_work_grab_env(req, def); io_req_work_grab_env(req, def);
*link = io_prep_linked_timeout(req); *link = io_prep_linked_timeout(req);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册