From f41b075492355c60d87ddd66371dcdb1ae9c484e Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 17 Mar 2026 14:28:44 -0600 Subject: [PATCH] io_uring: avoid req->ctx reload in io_req_put_rsrc_nodes() Cache 'ctx' to avoid it needing to get potentially reloaded. Signed-off-by: Jens Axboe --- io_uring/io_uring.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index d703f0a8b315..6eaa21e09469 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1073,12 +1073,14 @@ void io_queue_next(struct io_kiocb *req) static inline void io_req_put_rsrc_nodes(struct io_kiocb *req) { + struct io_ring_ctx *ctx = req->ctx; + if (req->file_node) { - io_put_rsrc_node(req->ctx, req->file_node); + io_put_rsrc_node(ctx, req->file_node); req->file_node = NULL; } if (req->flags & REQ_F_BUF_NODE) - io_put_rsrc_node(req->ctx, req->buf_node); + io_put_rsrc_node(ctx, req->buf_node); } static void io_free_batch_list(struct io_ring_ctx *ctx,