From: Anuj Gupta <anuj20.g@samsung.com>
To: Diangang Li <diangangli@gmail.com>
Cc: axboe@kernel.dk, asml.silence@gmail.com,
io-uring@vger.kernel.org, linux-kernel@vger.kernel.org,
Diangang Li <lidiangang@bytedance.com>
Subject: Re: [PATCH 2/2] io_uring/rw: honour RWF_NOWAIT when a dma-buf map is missing
Date: Thu, 3 Dec 2026 13:58:30 +0530 [thread overview]
Message-ID: <20261203082830.2619053-1-anuj20.g@samsung.com> (raw)
In-Reply-To: <20261130072837.4191677-2-diangangli@gmail.com>
On Mon, Nov 30, 2026 at 03:28:37PM +0800, Diangang Li wrote:
> 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.
RWF_NOWAIT is still ignored when the request is issued directly from
io-wq, for example with IOSQE_ASYNC. In that case, IO_URING_F_NONBLOCK
may not be set, so map creation can block.
One option is to pass a nowait argument to io_attach_dmabuf_map() that
takes both flags into account. Something like this, on top of this
patch [1]
Also, when the map is missing, an app doing only RWF_NOWAIT I/O would
keep getting -EAGAIN. It would need a blocking I/O to create the map,
including after invalidation.
[1]
diff --git a/io_uring/dma-buf.h b/io_uring/dma-buf.h
index d8d9b4f224d8..cb9c2d984ab5 100644
--- a/io_uring/dma-buf.h
+++ b/io_uring/dma-buf.h
@@ -28,9 +28,8 @@ static inline void io_detach_dmabuf_map(struct io_kiocb *req)
static inline int io_attach_dmabuf_map(struct io_kiocb *req,
struct iov_iter *iter,
- unsigned issue_flags)
+ bool nowait)
{
- bool nowait = issue_flags & IO_URING_F_NONBLOCK;
struct dma_buf_io_map *map;
struct io_buf_dma *bd;
diff --git a/io_uring/rw.c b/io_uring/rw.c
index 6e4e8fbc9ff1..cca27ab29c58 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -357,6 +357,8 @@ static int io_init_rw_fixed(struct io_kiocb *req, unsigned int issue_flags,
{
struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
struct io_async_rw *io = req->async_data;
+ bool nowait = (issue_flags & IO_URING_F_NONBLOCK) ||
+ (rw->flags & RWF_NOWAIT);
int ret;
if (!io->bytes_done) {
@@ -367,7 +369,7 @@ static int io_init_rw_fixed(struct io_kiocb *req, unsigned int issue_flags,
iov_iter_save_state(&io->iter, &io->iter_state);
}
- ret = io_attach_dmabuf_map(req, &io->iter, issue_flags);
+ ret = io_attach_dmabuf_map(req, &io->iter, nowait);
if (unlikely(ret)) {
/*
* This runs before io_rw_init_file() sets REQ_F_NOWAIT. Set it
next prev parent reply other threads:[~2026-12-03 8:30 UTC|newest]
Thread overview: 7+ 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 ` [PATCH 2/2] io_uring/rw: honour RWF_NOWAIT when a dma-buf map is missing Diangang Li
[not found] ` <CGME20261203082933epcas5p1bfb229c6feb82b6722133923a9ff3de0@epcas5p1.samsung.com>
2026-12-03 8:28 ` Anuj Gupta [this message]
2026-12-03 15:07 ` Pavel Begunkov
2026-12-04 2:35 ` Diangang Li
2026-12-03 12:10 ` [PATCH 1/2] io_uring/dma-buf: release the I/O context before the target file Pavel Begunkov
2026-12-03 12:53 ` Anuj gupta
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=20261203082830.2619053-1-anuj20.g@samsung.com \
--to=anuj20.g@samsung.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=diangangli@gmail.com \
--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®