mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yun Wang <arsenova@a7snv.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Pavel Begunkov <asml.silence@gmail.com>,
	Hao Xu <haoxu@linux.alibaba.com>,
	Mengmeng Zhao <mengmeng.zhao@linux.dev>,
	io-uring@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] io_uring: clear REQ_F_FORCE_ASYNC when reissuing a request
Date: Sun, 29 Nov 2026 18:33:44 +0000	[thread overview]
Message-ID: <20261129183214.3303492-3-arsenova@a7snv.com> (raw)
In-Reply-To: <20261129183214.3303492-1-arsenova@a7snv.com>

When a read or write is reissued, io_free_batch_list() clears
REQ_F_REISSUE and queues the request to io-wq, but leaves
REQ_F_FORCE_ASYNC set. For a request submitted with IOSQE_ASYNC on a
file that implements ->poll(), io_wq_submit_work() then issues it with
IO_URING_F_NONBLOCK again, so the retry that should be blocking is
another nonblocking attempt with IOCB_NOWAIT set. io_rw_should_reissue()
allows a reissue after a nonblocking attempt, so such a request is
still reissued forever when its completion keeps returning -EAGAIN or
-EOPNOTSUPP.

REQ_F_REISSUE means the nonblocking attempt has been made and the
request should now be issued from blocking context. Clear
REQ_F_FORCE_ASYNC together with it, so that io-wq issues the retry
blocking. The request is already being queued to io-wq at this point;
the only other effect is that the retry no longer sets
IO_WQ_WORK_CONCURRENT.

FUSE regular files implement ->poll(). With a FUSE server that has
FUSE_ASYNC_DIO and FOPEN_DIRECT_IO and answers every READ with
-EOPNOTSUPP or -EAGAIN, an IORING_OP_READ with IOSQE_ASYNC is still
reissued until the server stops failing with the previous patch alone.
With both patches it fails after two attempts.

Fixes: d803d123948f ("io_uring/rw: handle -EAGAIN retry at IO completion time")
Cc: stable@vger.kernel.org
Signed-off-by: Yun Wang <arsenova@a7snv.com>
---
 io_uring/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 5db57bf675f0..c08714d10d5b 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1187,7 +1187,7 @@ static void io_free_batch_list(struct io_ring_ctx *ctx,
 		if (unlikely(req->flags & IO_REQ_CLEAN_SLOW_FLAGS)) {
 			if (req->flags & REQ_F_REISSUE) {
 				node = req->comp_list.next;
-				req->flags &= ~REQ_F_REISSUE;
+				req->flags &= ~(REQ_F_REISSUE | REQ_F_FORCE_ASYNC);
 				io_queue_iowq(req);
 				continue;
 			}
-- 
2.56.1



  parent reply	other threads:[~2026-11-29 18:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 18:32 [PATCH 0/3] io_uring/rw: bound the -EAGAIN/-EOPNOTSUPP reissue Yun Wang
2026-11-29 18:33 ` [PATCH 1/3] io_uring/rw: don't reissue requests that were issued blocking Yun Wang
2026-11-29 18:33 ` Yun Wang [this message]
2026-11-29 18:34 ` [PATCH 3/3] io_uring/rw: don't retry dma-buf requests that fail with -EOPNOTSUPP Yun Wang

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=20261129183214.3303492-3-arsenova@a7snv.com \
    --to=arsenova@a7snv.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=haoxu@linux.alibaba.com \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mengmeng.zhao@linux.dev \
    /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®