summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-05-07 10:41:41 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-05-07 10:41:41 -0700
commitb366bd7d9613971e666cdbfe7a08c653d329bf15 (patch)
tree2e2cf28038b324aa4f972f4be110b299d56d59ff
parent4b97bac0756a81cda5afd45417a99b5bccdcff67 (diff)
parenta196c78b5443fc61af2c0490213b9d125482cbd1 (diff)
downloadlinux-b366bd7d9613971e666cdbfe7a08c653d329bf15.tar.bz2
Merge tag 'io_uring-5.18-2022-05-06' of git://git.kernel.dk/linux-block
Pull io_uring fix from Jens Axboe: "Just a single file assignment fix this week" * tag 'io_uring-5.18-2022-05-06' of git://git.kernel.dk/linux-block: io_uring: assign non-fixed early for async work
-rw-r--r--fs/io_uring.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index e01f595f5b7d..91de361ea9ab 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6947,7 +6947,12 @@ static int io_req_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
static int io_req_prep_async(struct io_kiocb *req)
{
- if (!io_op_defs[req->opcode].needs_async_setup)
+ const struct io_op_def *def = &io_op_defs[req->opcode];
+
+ /* assign early for deferred execution for non-fixed file */
+ if (def->needs_file && !(req->flags & REQ_F_FIXED_FILE))
+ req->file = io_file_get_normal(req, req->fd);
+ if (!def->needs_async_setup)
return 0;
if (WARN_ON_ONCE(req_has_async_data(req)))
return -EFAULT;