Re: [PATCH 1/3] io_uring/rw: don't reissue requests that were issued blocking

From: arsenova

Date: Thu Dec 03 2026 - 10:53:16 EST


On Thursday, December 3rd, 2026 at 8:51 PM, Anuj gupta <anuj1072538@xxxxxxxxx> wrote:

> > diff --git a/io_uring/rw.c b/io_uring/rw.c
> > index 3a8559ff4dc6..7917d1536c47 100644
> > --- a/io_uring/rw.c
> > +++ b/io_uring/rw.c
> > @@ -490,8 +490,10 @@ static bool io_rw_should_reissue(struct io_kiocb *req)
> >
> > if (!S_ISBLK(mode) && !S_ISREG(mode))
> > return false;
> > - if ((req->flags & REQ_F_NOWAIT) || (io_wq_current_is_worker() &&
> > - !(req->flags & REQ_F_IOPOLL)))
> > + if ((req->flags & REQ_F_NOWAIT) ||
> > + (!(req->flags & REQ_F_IOPOLL) &&
> > + (io_wq_current_is_worker() ||
> > + !(rw->kiocb.ki_flags & IOCB_NOWAIT))))
> > return false;
>
> With IOCB_NOWAIT indicating whether the attempt was issued in
> nonblocking mode, do we still need the io_wq_current_is_worker() check?
>
> With it, a nonblocking attempt completed with -EAGAIN in an io-wq
> worker is still not reissued.
>

Good point, my initial change was overly conservative.

With patch 2 applied, this check is indeed no longer needed. A blocking
attempt from io-wq never sets IOCB_NOWAIT; io-wq only passes
IO_URING_F_NONBLOCK for REQ_F_FORCE_ASYNC requests on pollable files
(such as FUSE), which patch 2 already prevents from looping on reissue.

I tested dropping it on top of the series (the FUSE reproducer with and
without IOSQE_ASYNC, NVMe fault injection, and the dma-buf raw bdev
probes), and the results match v1. So in v2, I'll drop the
io_wq_current_is_worker() check here:

if ((req->flags & REQ_F_NOWAIT) ||
(!(req->flags & REQ_F_IOPOLL) &&
!(rw->kiocb.ki_flags & IOCB_NOWAIT)))
return false;

I'll wait a few days for any other comments before sending v2.

Best regards,
Yun