From: Jens Axboe Date: Thu, 20 Jul 2023 19:16:53 +0000 (-0600) Subject: io_uring: treat -EAGAIN for REQ_F_NOWAIT as final for io-wq X-Git-Tag: v6.1.52~1094 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b87f546a035bd8b2b4c73cb346344af542d8663;p=platform%2Fkernel%2Flinux-starfive.git io_uring: treat -EAGAIN for REQ_F_NOWAIT as final for io-wq 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 38bc007..bd7b8cf 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1803,6 +1803,14 @@ fail: ret = io_issue_sqe(req, issue_flags); if (ret != -EAGAIN) 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; + /* * We can get EAGAIN for iopolled IO even though we're * forcing a sync submission from here, since we can't