From nobody Thu Oct 2 14:11:06 2025 Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97078301476; Mon, 15 Sep 2025 15:20:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=94.136.29.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757949608; cv=none; b=fmTIGA/mx+U+z5IkxwzkHbfFzQAVUppZJVcIdHif8K8ZrlodCF7fX1RDKcBdZFocLIPYkDHMPuJRX+oLsru+5kAQnHiMInbeL96nS+8/jf2NJhVCI+dN3wtDrtTgRpQZnMOd9PRT+W4Le1vEsStaP5FYuNv51z4709NzUPv9xDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757949608; c=relaxed/simple; bh=r0XPNJ2T0NahYpxtTRPPDjeCs7eUxcldKZ6+StMISqE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eGJqIcDx+pw3BkGUcGg93qlmH/yaa2xiNSCyCRagDMKsvVw13EWTrpZjBQKaA1xRmiBe5t5XYHtU0dmsAUeW3cdstL/VimsyU4pGBO4nm+mlisRrSAdgmnDNZOCXTN9UlQCfBB12dbrDSgtv4N8fYOcBAyXHuJ/tLpk4FpR3Dt8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com; spf=pass smtp.mailfrom=proxmox.com; arc=none smtp.client-ip=94.136.29.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proxmox.com Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 06B2E4BCA9; Mon, 15 Sep 2025 17:19:57 +0200 (CEST) From: Fiona Ebner To: linux-kernel@vger.kernel.org Cc: samba-technical@lists.samba.org, linux-cifs@vger.kernel.org, bharathsm@microsoft.com, tom@talpey.com, sprasad@microsoft.com, ronniesahlberg@gmail.com, pc@manguebit.org, sfrench@samba.org Subject: [PATCH 1/2] smb: client: transport: avoid reconnects triggered by pending task work Date: Mon, 15 Sep 2025 17:19:39 +0200 Message-ID: <20250915151950.1017597-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250915151950.1017597-1-f.ebner@proxmox.com> References: <20250915151950.1017597-1-f.ebner@proxmox.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1757949589672 Content-Type: text/plain; charset="utf-8" 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 --- 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 a61ba7f3fb86..940e90107134 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" @@ -173,9 +174,16 @@ smb_send_kvec(struct TCP_Server_Info *server, struct m= sghdr *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 =3D sock_sendmsg(ssocket, smb_msg); - if (rc =3D=3D -EAGAIN) { + if (rc =3D=3D -EAGAIN || unlikely(rc =3D=3D -EINTR && task_work_pending(= current))) { retries++; if (retries >=3D 14 || (!server->noblocksnd && (retries > 2))) { --=20 2.47.2 From nobody Thu Oct 2 14:11:06 2025 Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAB362C3244; Mon, 15 Sep 2025 15:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=94.136.29.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757949607; cv=none; b=F4FPx+pEKutLr8atwXz8AgLXJZsMUxdOmU7mnmBgW1HZWqfXKeinw5Uc6wdwk0lKalRc4m0/2e6i5svrd4xdwFxwPdI3RpXHwydICw/DosV9H37cuo5BBqtlGUzt1g5fhjCFpR2X6lbtJEfODFVpDxQPK+9Uj/oZf2eyqsqNr38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757949607; c=relaxed/simple; bh=NXuP5K9byF+0SV2cRgyBBWxmcgD6qytN28Kfpsj6cIA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OEQZANMygiefm5gTS+fV1/JRgEvhBPysP/j+mwVeLSYrgqwnnzGhqUSHB0rC8NS3qc5e/Ky6pjNeJ/y9WEDE0fPuidx1ISG62Twtxdt1a84HlMuy0Tb4yDIjIZmEmekCc9eiGO9/jG4SvnC0NYXksmWEMkskYOiKAw6uc99Y2A4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com; spf=pass smtp.mailfrom=proxmox.com; arc=none smtp.client-ip=94.136.29.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proxmox.com Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id EB1C64BCAA; Mon, 15 Sep 2025 17:19:56 +0200 (CEST) From: Fiona Ebner To: linux-kernel@vger.kernel.org Cc: samba-technical@lists.samba.org, linux-cifs@vger.kernel.org, bharathsm@microsoft.com, tom@talpey.com, sprasad@microsoft.com, ronniesahlberg@gmail.com, pc@manguebit.org, sfrench@samba.org Subject: [PATCH 2/2] smb: client: transport: minor indentation style fix Date: Mon, 15 Sep 2025 17:19:40 +0200 Message-ID: <20250915151950.1017597-3-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250915151950.1017597-1-f.ebner@proxmox.com> References: <20250915151950.1017597-1-f.ebner@proxmox.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1757949589741 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fiona Ebner --- fs/smb/client/transport.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c index 940e90107134..051cd9dbba13 100644 --- a/fs/smb/client/transport.c +++ b/fs/smb/client/transport.c @@ -331,8 +331,7 @@ int __smb_send_rqst(struct TCP_Server_Info *server, int= num_rqst, break; total_len +=3D sent; } - -} + } =20 unmask: sigprocmask(SIG_SETMASK, &oldmask, NULL); --=20 2.47.2