public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Shyam Prasad N <sprasad@microsoft.com>,
	Steve French <stfrench@microsoft.com>,
	Sasha Levin <sashal@kernel.org>,
	sfrench@samba.org, linux-cifs@vger.kernel.org,
	samba-technical@lists.samba.org
Subject: [PATCH AUTOSEL 6.1 09/15] cifs: translate network errors on send to -ECONNABORTED
Date: Fri,  2 Feb 2024 13:40:46 -0500	[thread overview]
Message-ID: <20240202184057.541411-9-sashal@kernel.org> (raw)
In-Reply-To: <20240202184057.541411-1-sashal@kernel.org>

From: Shyam Prasad N <sprasad@microsoft.com>

[ Upstream commit a68106a6928e0a6680f12bcc7338c0dddcfe4d11 ]

When the network stack returns various errors, we today bubble
up the error to the user (in case of soft mounts).

This change translates all network errors except -EINTR and
-EAGAIN to -ECONNABORTED. A similar approach is taken when
we receive network errors when reading from the socket.

The change also forces the cifsd thread to reconnect during
it's next activity.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/smb/client/transport.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
index 8a1dd8407a3a..97bf46de8e42 100644
--- a/fs/smb/client/transport.c
+++ b/fs/smb/client/transport.c
@@ -427,10 +427,17 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
 						  server->conn_id, server->hostname);
 	}
 smbd_done:
-	if (rc < 0 && rc != -EINTR)
+	/*
+	 * there's hardly any use for the layers above to know the
+	 * actual error code here. All they should do at this point is
+	 * to retry the connection and hope it goes away.
+	 */
+	if (rc < 0 && rc != -EINTR && rc != -EAGAIN) {
 		cifs_server_dbg(VFS, "Error %d sending data on socket to server\n",
 			 rc);
-	else if (rc > 0)
+		rc = -ECONNABORTED;
+		cifs_signal_cifsd_for_reconnect(server, false);
+	} else if (rc > 0)
 		rc = 0;
 out:
 	cifs_in_send_dec(server);
-- 
2.43.0


  parent reply	other threads:[~2024-02-02 18:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 18:40 [PATCH AUTOSEL 6.1 01/15] wifi: cfg80211: fix missing interfaces when dumping Sasha Levin
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 02/15] wifi: mac80211: fix race condition on enabling fast-xmit Sasha Levin
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 03/15] fbdev: savage: Error out if pixclock equals zero Sasha Levin
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 04/15] fbdev: sis: " Sasha Levin
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 05/15] x86/cpu: Add model number for Intel Clearwater Forest processor Sasha Levin
2024-02-18 19:14   ` Pavel Machek
2024-02-22 12:34     ` Sasha Levin
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 06/15] spi: hisi-sfc-v3xx: Return IRQ_NONE if no interrupts were detected Sasha Levin
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 07/15] block: Fix WARNING in _copy_from_iter Sasha Levin
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 08/15] smb: Work around Clang __bdos() type confusion Sasha Levin
2024-02-02 18:40 ` Sasha Levin [this message]
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 10/15] ahci: asm1166: correct count of reported ports Sasha Levin
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 11/15] aoe: avoid potential deadlock at set_capacity Sasha Levin
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 12/15] exec: Distinguish in_execve from in_exec Sasha Levin
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 13/15] ahci: add 43-bit DMA address quirk for ASMedia ASM1061 controllers Sasha Levin
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 14/15] MIPS: reserve exception vector space ONLY ONCE Sasha Levin
2024-02-02 18:40 ` [PATCH AUTOSEL 6.1 15/15] platform/x86: touchscreen_dmi: Add info for the TECLAST X16 Plus tablet Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240202184057.541411-9-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samba-technical@lists.samba.org \
    --cc=sfrench@samba.org \
    --cc=sprasad@microsoft.com \
    --cc=stable@vger.kernel.org \
    --cc=stfrench@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox