]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
io_uring/rw: use cached file rather than req->file
authorJens Axboe <axboe@kernel.dk>
Tue, 17 Mar 2026 20:21:58 +0000 (14:21 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 17 Mar 2026 20:35:00 +0000 (14:35 -0600)
In io_rw_init_file(), req->file is cached in file, yet the former is
still being used when checking for O_DIRECT. As this is post setting
the kiocb flags, the compiler has to reload req->file. Just use the
locally cached file instead.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/rw.c

index 3bdb9914e6734093011c560fe89487aa7f62a69a..046f76a71b9c187d897dcbe5d82dc848f54101aa 100644 (file)
@@ -900,7 +900,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type)
                 * We have a union of meta fields with wpq used for buffered-io
                 * in io_async_rw, so fail it here.
                 */
-               if (!(req->file->f_flags & O_DIRECT))
+               if (!(file->f_flags & O_DIRECT))
                        return -EOPNOTSUPP;
                kiocb->ki_flags |= IOCB_HAS_METADATA;
                kiocb->private = &io->meta;