From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 5EF5969ED1 for ; Thu, 29 Jul 2021 11:51:12 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3019D2D6C0 for ; Thu, 29 Jul 2021 11:50:42 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id A74EA2D6B4 for ; Thu, 29 Jul 2021 11:50:39 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 69E3242C38 for ; Thu, 29 Jul 2021 11:50:39 +0200 (CEST) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Thu, 29 Jul 2021 11:50:31 +0200 Message-Id: <20210729095031.90694-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.467 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH v2 qemu] io_uring: resubmit when result is -EAGAIN X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 09:51:12 -0000 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 --- 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 +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 +Reviewed-by: Stefano Garzarella +Signed-off-by: Fabian Ebner +--- + 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