From: Diangang Li <diangangli@gmail.com>
To: axboe@kernel.dk, asml.silence@gmail.com
Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org,
Diangang Li <lidiangang@bytedance.com>
Subject: [PATCH 2/2] io_uring/rw: honour RWF_NOWAIT when a dma-buf map is missing
Date: Mon, 30 Nov 2026 15:28:37 +0800 [thread overview]
Message-ID: <20261130072837.4191677-2-diangangli@gmail.com> (raw)
In-Reply-To: <20261130072837.4191677-1-diangangli@gmail.com>
From: Diangang Li <lidiangang@bytedance.com>
On nonblocking issue, io_attach_dmabuf_map() returns -EAGAIN if no map is
available. This happens before io_rw_init_file() sets REQ_F_NOWAIT, so
an RWF_NOWAIT request is punted to io-wq and can block instead of
completing with -EAGAIN.
Set REQ_F_NOWAIT on this path to prevent the retry. Requests issued
directly from io-wq can still create the map in blocking mode.
Fixes: 62e4bf5b25d4 ("io_uring/rsrc: add dmabuf backed registered buffers")
Assisted-by: LLM
Signed-off-by: Diangang Li <lidiangang@bytedance.com>
---
io_uring/rw.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/io_uring/rw.c b/io_uring/rw.c
index 3ecb842147a4..6e4e8fbc9ff1 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -368,8 +368,16 @@ static int io_init_rw_fixed(struct io_kiocb *req, unsigned int issue_flags,
}
ret = io_attach_dmabuf_map(req, &io->iter, issue_flags);
- if (ret)
+ if (unlikely(ret)) {
+ /*
+ * This runs before io_rw_init_file() sets REQ_F_NOWAIT. Set it
+ * here for RWF_NOWAIT, or -EAGAIN for a map that doesn't exist
+ * yet punts the request to io-wq, where it will block.
+ */
+ if (ret == -EAGAIN && (rw->flags & RWF_NOWAIT))
+ io_req_set_flags(req, REQ_F_NOWAIT);
return ret;
+ }
return 0;
}
--
2.39.5
prev parent reply other threads:[~2026-11-30 7:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 7:28 [PATCH 1/2] io_uring/dma-buf: release the I/O context before the target file Diangang Li
2026-11-30 7:28 ` Diangang Li [this message]
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=20261130072837.4191677-2-diangangli@gmail.com \
--to=diangangli@gmail.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=lidiangang@bytedance.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®