aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorFabian Ebner <f.ebner@proxmox.com>2021-07-29 11:10:29 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2021-07-29 17:14:55 +0100
commit54caccb3657e3960d8f5d57ab8e867028325d131 (patch)
treeee24f233b3afb6d9d5bb2afd304f49c6196defb7 /block
parent0ef2801423be33d80b52b14b6b55b3713a325dba (diff)
downloadqemu-54caccb3657e3960d8f5d57ab8e867028325d131.zip
qemu-54caccb3657e3960d8f5d57ab8e867028325d131.tar.gz
qemu-54caccb3657e3960d8f5d57ab8e867028325d131.tar.bz2
block/io_uring: resubmit when result is -EAGAIN
Linux SCSI can throw spurious -EAGAIN in some corner cases in its completion path, which will end up being the result in the completed io_uring request. Resubmitting such requests should allow block jobs to complete, even if such spurious errors are encountered. Co-authored-by: Stefan Hajnoczi <stefanha@gmail.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> Message-id: 20210729091029.65369-1-f.ebner@proxmox.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/io_uring.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/block/io_uring.c b/block/io_uring.c
index 00a3ee9..dfa475c 100644
--- a/block/io_uring.c
+++ b/block/io_uring.c
@@ -165,7 +165,21 @@ static void luring_process_completions(LuringState *s)
total_bytes = ret + luringcb->total_read;
if (ret < 0) {
- if (ret == -EINTR) {
+ /*
+ * Only writev/readv/fsync requests on regular files or host block
+ * devices are submitted. Therefore -EAGAIN is not expected but it's
+ * known to happen sometimes with Linux SCSI. Submit again and hope
+ * the request completes successfully.
+ *
+ * For more information, see:
+ * https://lore.kernel.org/io-uring/20210727165811.284510-3-axboe@kernel.dk/T/#u
+ *
+ * If the code is changed to submit other types of requests in the
+ * future, then this workaround may need to be extended to deal with
+ * genuine -EAGAIN results that should not be resubmitted
+ * immediately.
+ */
+ if (ret == -EINTR || ret == -EAGAIN) {
luring_resubmit(s, luringcb);
continue;
}