Commit edcdfcc1 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: do init work in grab_env()

Place io_req_init_async() in io_req_work_grab_env() so it won't be
forgotten.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 351fd535
...@@ -1105,6 +1105,8 @@ static inline void io_req_work_grab_env(struct io_kiocb *req) ...@@ -1105,6 +1105,8 @@ static inline void io_req_work_grab_env(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->work.mm && def->needs_mm) { if (!req->work.mm && def->needs_mm) {
mmgrab(current->mm); mmgrab(current->mm);
req->work.mm = current->mm; req->work.mm = current->mm;
...@@ -1161,9 +1163,7 @@ static inline void io_prep_async_work(struct io_kiocb *req, ...@@ -1161,9 +1163,7 @@ 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); io_req_work_grab_env(req);
*link = io_prep_linked_timeout(req); *link = io_prep_linked_timeout(req);
} }
...@@ -5254,10 +5254,8 @@ static int io_req_defer_prep(struct io_kiocb *req, ...@@ -5254,10 +5254,8 @@ static int io_req_defer_prep(struct io_kiocb *req,
return ret; return ret;
} }
if (for_async || (req->flags & REQ_F_WORK_INITIALIZED)) { if (for_async || (req->flags & REQ_F_WORK_INITIALIZED))
io_req_init_async(req);
io_req_work_grab_env(req); io_req_work_grab_env(req);
}
switch (req->opcode) { switch (req->opcode) {
case IORING_OP_NOP: case IORING_OP_NOP:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment