public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: io-uring@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 4/5] io_uring/rw: use cached file rather than req->file
Date: Tue, 17 Mar 2026 14:35:17 -0600	[thread overview]
Message-ID: <20260317203622.1007183-5-axboe@kernel.dk> (raw)
In-Reply-To: <20260317203622.1007183-1-axboe@kernel.dk>

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/rw.c b/io_uring/rw.c
index 3bdb9914e673..046f76a71b9c 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -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;
-- 
2.53.0


  parent reply	other threads:[~2026-03-17 20:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17 20:35 [PATCHSET for-next 0/5] Various minor cleanups Jens Axboe
2026-03-17 20:35 ` [PATCH 1/5] io_uring/kbuf: use 'ctx' consistently Jens Axboe
2026-03-17 20:35 ` [PATCH 2/5] io_uring/poll: cache req->apoll_events Jens Axboe
2026-03-17 20:35 ` [PATCH 3/5] io_uring/net: use 'ctx' consistently Jens Axboe
2026-03-17 20:35 ` Jens Axboe [this message]
2026-03-17 20:35 ` [PATCH 5/5] io_uring: avoid req->ctx reload in io_req_put_rsrc_nodes() Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260317203622.1007183-5-axboe@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox