]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
io_uring: treat -EAGAIN for REQ_F_NOWAIT as final for io-wq
authorJens Axboe <axboe@kernel.dk>
Thu, 20 Jul 2023 19:16:53 +0000 (13:16 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Aug 2023 08:22:47 +0000 (10:22 +0200)
commit a9be202269580ca611c6cebac90eaf1795497800 upstream.

io-wq assumes that an issue is blocking, but it may not be if the
request type has asked for a non-blocking attempt. If we get
-EAGAIN for that case, then we need to treat it as a final result
and not retry or arm poll for it.

Cc: stable@vger.kernel.org # 5.10+
Link: https://github.com/axboe/liburing/issues/897
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/io_uring.c

index f65c6811ede81eef50c9ea9b565919261542900c..774b1ae8adf7cb8c4531dd670c6170dee03c1198 100644 (file)
@@ -7066,6 +7066,14 @@ static void io_wq_submit_work(struct io_wq_work *work)
                         */
                        if (ret != -EAGAIN || !(req->ctx->flags & IORING_SETUP_IOPOLL))
                                break;
+
+                       /*
+                        * If REQ_F_NOWAIT is set, then don't wait or retry with
+                        * poll. -EAGAIN is final for that case.
+                        */
+                       if (req->flags & REQ_F_NOWAIT)
+                               break;
+
                        cond_resched();
                } while (1);
        }