* [pve-devel] [PATCH v2 qemu] io_uring: resubmit when result is -EAGAIN
@ 2021-07-29 9:50 Fabian Ebner
2021-07-29 15:59 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Fabian Ebner @ 2021-07-29 9:50 UTC (permalink / raw)
To: pve-devel
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.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
Changes from v1:
* make it a patch for pve-qemu instead of the qemu submodule
* use v2 of the patch with a comment by Stefan Hajnoczi
...uring-resubmit-when-result-is-EAGAIN.patch | 49 +++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 50 insertions(+)
create mode 100644 debian/patches/extra/0002-block-io_uring-resubmit-when-result-is-EAGAIN.patch
diff --git a/debian/patches/extra/0002-block-io_uring-resubmit-when-result-is-EAGAIN.patch b/debian/patches/extra/0002-block-io_uring-resubmit-when-result-is-EAGAIN.patch
new file mode 100644
index 0000000..b5dd07a
--- /dev/null
+++ b/debian/patches/extra/0002-block-io_uring-resubmit-when-result-is-EAGAIN.patch
@@ -0,0 +1,49 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Fabian Ebner <f.ebner@proxmox.com>
+Date: Fri, 23 Jul 2021 12:42:23 +0200
+Subject: [PATCH] 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>
+---
+ block/io_uring.c | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/block/io_uring.c b/block/io_uring.c
+index 00a3ee9fb8..dfa475cc87 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;
+ }
+--
+2.30.2
+
diff --git a/debian/patches/series b/debian/patches/series
index ada674b..6edf8ce 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,5 @@
extra/0001-monitor-qmp-fix-race-on-CHR_EVENT_CLOSED-without-OOB.patch
+extra/0002-block-io_uring-resubmit-when-result-is-EAGAIN.patch
bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch
bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch
bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: Re: [PATCH v2 qemu] io_uring: resubmit when result is -EAGAIN
2021-07-29 9:50 [pve-devel] [PATCH v2 qemu] io_uring: resubmit when result is -EAGAIN Fabian Ebner
@ 2021-07-29 15:59 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-07-29 15:59 UTC (permalink / raw)
To: Proxmox VE development discussion, Fabian Ebner
Cc: Fabian Grünbichler, Wolfgang Bumiller
On 29/07/2021 11:50, Fabian Ebner wrote:
> 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.
>
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
>
> Changes from v1:
> * make it a patch for pve-qemu instead of the qemu submodule
> * use v2 of the patch with a comment by Stefan Hajnoczi
>
> ...uring-resubmit-when-result-is-EAGAIN.patch | 49 +++++++++++++++++++
> debian/patches/series | 1 +
> 2 files changed, 50 insertions(+)
> create mode 100644 debian/patches/extra/0002-block-io_uring-resubmit-when-result-is-EAGAIN.patch
>
>
applied, thanks!
For others regarding bump: while this is def. correct it actually increases the
likelihood of a kernel crash with old (<< pve-kernel-5.11.22-3-pve 5.11.22-6)
kernels. As now it was either a crash or a block job error, this patch basically
converts the block job errors into crashes on bad old kernel and into avoiding
a block job error on the OK behavior of resubmitting on EAGAIN on new kernels.
Those that saw neither crash nor block job errors won't notice a difference
either way.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-29 15:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 9:50 [pve-devel] [PATCH v2 qemu] io_uring: resubmit when result is -EAGAIN Fabian Ebner
2021-07-29 15:59 ` [pve-devel] applied: " Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal