1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Fabian Ebner <f.ebner@proxmox.com>
3 Date: Fri, 23 Jul 2021 12:42:23 +0200
4 Subject: [PATCH] block/io_uring: resubmit when result is -EAGAIN
6 Linux SCSI can throw spurious -EAGAIN in some corner cases in its
7 completion path, which will end up being the result in the completed
10 Resubmitting such requests should allow block jobs to complete, even
11 if such spurious errors are encountered.
13 Co-authored-by: Stefan Hajnoczi <stefanha@gmail.com>
14 Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
15 Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
17 block/io_uring.c | 16 +++++++++++++++-
18 1 file changed, 15 insertions(+), 1 deletion(-)
20 diff --git a/block/io_uring.c b/block/io_uring.c
21 index 00a3ee9fb8..dfa475cc87 100644
22 --- a/block/io_uring.c
23 +++ b/block/io_uring.c
24 @@ -165,7 +165,21 @@ static void luring_process_completions(LuringState *s)
25 total_bytes = ret + luringcb->total_read;
28 - if (ret == -EINTR) {
30 + * Only writev/readv/fsync requests on regular files or host block
31 + * devices are submitted. Therefore -EAGAIN is not expected but it's
32 + * known to happen sometimes with Linux SCSI. Submit again and hope
33 + * the request completes successfully.
35 + * For more information, see:
36 + * https://lore.kernel.org/io-uring/20210727165811.284510-3-axboe@kernel.dk/T/#u
38 + * If the code is changed to submit other types of requests in the
39 + * future, then this workaround may need to be extended to deal with
40 + * genuine -EAGAIN results that should not be resubmitted
43 + if (ret == -EINTR || ret == -EAGAIN) {
44 luring_resubmit(s, luringcb);