summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-06-29 19:18:41 +0300
committerJens Axboe <axboe@kernel.dk>2020-06-30 08:39:59 -0600
commitedcdfcc149a8d0c11d4dd2b23b5338af22e31a5f (patch)
tree4d74db4c567009dbac1d5c8f721a33c8ec512bae /fs/io_uring.c
parent351fd53595a3ceb88756a005e3b864f7c8cb86e4 (diff)
downloadlwn-edcdfcc149a8d0c11d4dd2b23b5338af22e31a5f.tar.gz
lwn-edcdfcc149a8d0c11d4dd2b23b5338af22e31a5f.zip
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: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 2b7666e81c13..3b2f6fd8f58f 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -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];
+ io_req_init_async(req);
+
if (!req->work.mm && def->needs_mm) {
mmgrab(current->mm);
req->work.mm = current->mm;
@@ -1161,9 +1163,7 @@ static inline void io_prep_async_work(struct io_kiocb *req,
req->work.flags |= IO_WQ_WORK_UNBOUND;
}
- io_req_init_async(req);
io_req_work_grab_env(req);
-
*link = io_prep_linked_timeout(req);
}
@@ -5254,10 +5254,8 @@ static int io_req_defer_prep(struct io_kiocb *req,
return ret;
}
- if (for_async || (req->flags & REQ_F_WORK_INITIALIZED)) {
- io_req_init_async(req);
+ if (for_async || (req->flags & REQ_F_WORK_INITIALIZED))
io_req_work_grab_env(req);
- }
switch (req->opcode) {
case IORING_OP_NOP: