From: Pavel Begunkov Date: Fri, 13 May 2022 10:24:56 +0000 (+0100) Subject: io_uring: avoid io-wq -EAGAIN looping for !IOPOLL X-Git-Tag: v5.18.3~421 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=598afcea1350331ec6e8b6405824329f4dd6c727;p=thirdparty%2Fkernel%2Fstable.git io_uring: avoid io-wq -EAGAIN looping for !IOPOLL [ Upstream commit e0deb6a025ae8c850dc8685be39fb27b06c88736 ] If an opcode handler semi-reliably returns -EAGAIN, io_wq_submit_work() might continue busily hammer the same handler over and over again, which is not ideal. The -EAGAIN handling in question was put there only for IOPOLL, so restrict it to IOPOLL mode only where there is no other recourse than to retry as we cannot wait. Fixes: def596e9557c9 ("io_uring: support for IO polling") Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/f168b4f24181942f3614dd8ff648221736f572e6.1652433740.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- diff --git a/fs/io_uring.c b/fs/io_uring.c index e0823f58f7959..7272e410d24aa 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7327,6 +7327,8 @@ fail: * wait for request slots on the block side. */ if (!needs_poll) { + if (!(req->ctx->flags & IORING_SETUP_IOPOLL)) + break; cond_resched(); continue; }