Skip to content

Commit

Permalink
cifs: translate network errors on send to -ECONNABORTED
Browse files Browse the repository at this point in the history
[ Upstream commit a68106a ]

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>
  • Loading branch information
sprasad-microsoft authored and gregkh committed Mar 1, 2024
1 parent 59e04d3 commit c09de6b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions fs/smb/client/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c09de6b

Please sign in to comment.