From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id BD84B1FF187 for ; Mon, 6 Oct 2025 11:25:03 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A5A4426DA7; Mon, 6 Oct 2025 11:25:04 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Mon, 6 Oct 2025 11:24:21 +0200 Message-ID: <20251006092428.756414-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1759742643251 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.023 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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 kernel] cherry-pick fix for problematic CIFS/io_uring interaction 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" When io_uring is used in the same task as CIFS, there might be unnecessary reconnects, which QEMU will treat as an IO error. This has been a long-standing issue [0] and was partially mitigated by qemu-server commit e31762f2 ("fix #4099: disable io_uring for virtual disks on CIFS storages"). However, back then it was not clear that it's enough to have IO via io_uring and IO via CIFS be present in the same task, even if io_uring is not used for CIFS. The issue resurfaced when QEMU blockdev mirroring was used with the source side using io_uring and the target being CIFS. This was reported by Aaron Lauterer and Friedrich Weber. It's also enough to have a VM with two disks, one using io_uring and one using CIFS and doing IO on both, to trigger the issue. Fix the issue by picking up the accepted fix from upstream, i.e. kernel commit 00be6f26a2a7 ("smb: client: transport: avoid reconnects triggered by pending task work"). [0]: https://bugzilla.proxmox.com/show_bug.cgi?id=4099 Signed-off-by: Fiona Ebner --- ...port-avoid-reconnects-triggered-by-p.patch | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 patches/kernel/0027-smb-client-transport-avoid-reconnects-triggered-by-p.patch diff --git a/patches/kernel/0027-smb-client-transport-avoid-reconnects-triggered-by-p.patch b/patches/kernel/0027-smb-client-transport-avoid-reconnects-triggered-by-p.patch new file mode 100644 index 0000000..c5fbf0b --- /dev/null +++ b/patches/kernel/0027-smb-client-transport-avoid-reconnects-triggered-by-p.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fiona Ebner +Date: Mon, 15 Sep 2025 17:19:39 +0200 +Subject: [PATCH] smb: client: transport: avoid reconnects triggered by pending + task work + +When io_uring is used in the same task as CIFS, there might be +unnecessary reconnects, causing issues in user-space applications +like QEMU with a log like: + +> CIFS: VFS: \\10.10.100.81 Error -512 sending data on socket to server + +Certain io_uring completions might be added to task_work with +notify_method being TWA_SIGNAL and thus TIF_NOTIFY_SIGNAL is set for +the task. + +In __smb_send_rqst(), signals are masked before calling +smb_send_kvec(), but the masking does not apply to TIF_NOTIFY_SIGNAL. + +If sk_stream_wait_memory() is reached via sock_sendmsg() while +TIF_NOTIFY_SIGNAL is set, signal_pending(current) will evaluate to +true there, and -EINTR will be propagated all the way from +sk_stream_wait_memory() to sock_sendmsg() in smb_send_kvec(). +Afterwards, __smb_send_rqst() will see that not everything was written +and reconnect. + +Signed-off-by: Fiona Ebner +Signed-off-by: Steve French +(cherry picked from commit 00be6f26a2a7c671f1402d74c4d3c30a5844660a) +Signed-off-by: Fiona Ebner +--- + fs/smb/client/transport.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c +index f151445b7370bba54593ab1f621a878343267e86..ba864cb9c9fa119659b523ce65155f6400002fd4 100644 +--- a/fs/smb/client/transport.c ++++ b/fs/smb/client/transport.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #include "cifspdu.h" + #include "cifsglob.h" + #include "cifsproto.h" +@@ -212,9 +213,16 @@ smb_send_kvec(struct TCP_Server_Info *server, struct msghdr *smb_msg, + * send a packet. In most cases if we fail to send + * after the retries we will kill the socket and + * reconnect which may clear the network problem. ++ * ++ * Even if regular signals are masked, EINTR might be ++ * propagated from sk_stream_wait_memory() to here when ++ * TIF_NOTIFY_SIGNAL is used for task work. For example, ++ * certain io_uring completions will use that. Treat ++ * having EINTR with pending task work the same as EAGAIN ++ * to avoid unnecessary reconnects. + */ + rc = sock_sendmsg(ssocket, smb_msg); +- if (rc == -EAGAIN) { ++ if (rc == -EAGAIN || unlikely(rc == -EINTR && task_work_pending(current))) { + retries++; + if (retries >= 14 || + (!server->noblocksnd && (retries > 2))) { -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel