From: Jens Axboe Date: Thu, 27 Aug 2020 00:58:26 +0000 (-0600) Subject: io_uring: clear req->result on IOPOLL re-issue X-Git-Tag: v5.8.6~69 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1506fdcde864b57d7761656a5d8a7142c829f3b8;p=thirdparty%2Fkernel%2Fstable.git io_uring: clear req->result on IOPOLL re-issue commit 56450c20fe10d4d93f58019109aa4e06fc0b9206 upstream. Make sure we clear req->result, which was set to -EAGAIN for retry purposes, when moving it to the reissue list. Otherwise we can end up retrying a request more than once, which leads to weird results in the io-wq handling (and other spots). Cc: stable@vger.kernel.org Reported-by: Andres Freund Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 26978630378e0..b966e2b8a77da 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1810,6 +1810,7 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events, req = list_first_entry(done, struct io_kiocb, list); if (READ_ONCE(req->result) == -EAGAIN) { + req->result = 0; req->iopoll_completed = 0; list_move_tail(&req->list, &again); continue;