aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--fs/io_uring.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index b54e358e6b31..2b7666e81c13 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1101,9 +1101,10 @@ static void __io_commit_cqring(struct io_ring_ctx *ctx)
}
}
-static inline void io_req_work_grab_env(struct io_kiocb *req,
- const struct io_op_def *def)
+static inline void io_req_work_grab_env(struct io_kiocb *req)
{
+ const struct io_op_def *def = &io_op_defs[req->opcode];
+
if (!req->work.mm && def->needs_mm) {
mmgrab(current->mm);
req->work.mm = current->mm;
@@ -1161,7 +1162,7 @@ static inline void io_prep_async_work(struct io_kiocb *req,
}
io_req_init_async(req);
- io_req_work_grab_env(req, def);
+ io_req_work_grab_env(req);
*link = io_prep_linked_timeout(req);
}
@@ -5255,7 +5256,7 @@ static int io_req_defer_prep(struct io_kiocb *req,
if (for_async || (req->flags & REQ_F_WORK_INITIALIZED)) {
io_req_init_async(req);
- io_req_work_grab_env(req, &io_op_defs[req->opcode]);
+ io_req_work_grab_env(req);
}
switch (req->opcode) {