Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: nspmangalore@gmail.com
To: linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@manguebit.com,
	bharathsm@microsoft.com, tom@talpey.com
Cc: Shyam Prasad N <sprasad@microsoft.com>
Subject: [PATCH 4/7] cifs: translate network errors on send to -ECONNABORTED
Date: Sun, 21 Jan 2024 03:32:45 +0000	[thread overview]
Message-ID: <20240121033248.125282-4-sprasad@microsoft.com> (raw)
In-Reply-To: <20240121033248.125282-1-sprasad@microsoft.com>

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

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>
---
 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 8695c9961f5a..e00278fcfa4f 100644
--- a/fs/smb/client/transport.c
+++ b/fs/smb/client/transport.c
@@ -400,10 +400,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.34.1


  parent reply	other threads:[~2024-01-21  3:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-21  3:32 [PATCH 1/7] cifs: handle servers that still advertise multichannel after disabling nspmangalore
2024-01-21  3:32 ` [PATCH 2/7] cifs: cifs_pick_channel should try selecting active channels nspmangalore
2024-01-21  3:32 ` [PATCH 3/7] cifs: smb2_close_getattr should also update i_size nspmangalore
2024-01-23  7:22   ` Shyam Prasad N
2024-01-23  7:47     ` Shyam Prasad N
2024-01-24  2:27       ` Steve French
2024-01-21  3:32 ` nspmangalore [this message]
2024-01-21  3:32 ` [PATCH 5/7] cifs: helper function to check replayable error codes nspmangalore
2024-01-21  3:32 ` [PATCH 6/7] cifs: commands that are retried should have replay flag set nspmangalore
2024-01-21  3:32 ` [PATCH 7/7] cifs: set replay flag for retries of write command nspmangalore
2024-01-21  4:02   ` Steve French
2024-01-21  4:02 ` [PATCH 1/7] cifs: handle servers that still advertise multichannel after disabling Steve French
2024-01-23  4:39   ` Shyam Prasad N

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=20240121033248.125282-4-sprasad@microsoft.com \
    --to=nspmangalore@gmail.com \
    --cc=bharathsm@microsoft.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@manguebit.com \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.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