summaryrefslogtreecommitdiff
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-01-22 12:12:26 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2022-01-22 12:12:26 +0300
commit8205ae327e396820fb7a176a94768146ac0b87ea (patch)
treed3f7a168c74fb5e79663176450cd83c44176840c /fs/cifs/transport.c
parent1cb69c8044fd534a0e19154831234d75f7b8d447 (diff)
parent51620150ca2df62f8ea472ab8962be590c957288 (diff)
downloadlinux-8205ae327e396820fb7a176a94768146ac0b87ea.tar.xz
Merge tag '5.17-rc-part2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: - multichannel fixes, addressing additional reconnect and DFS scenarios - reenabling fscache support (indexing rewrite, metadata caching e.g.) - send additional version information during NTLMSSP negotiate to improve debugging - fix for a mount race - DFS fixes - fix for a memory leak for stable * tag '5.17-rc-part2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: update internal module number smb3: send NTLMSSP version information cifs: Support fscache indexing rewrite cifs: cifs_ses_mark_for_reconnect should also update reconnect bits cifs: update tcpStatus during negotiate and sess setup cifs: make status checks in version independent callers cifs: remove repeated state change in dfs tree connect cifs: fix the cifs_reconnect path for DFS cifs: remove unused variable ses_selected cifs: protect all accesses to chan_* with chan_lock cifs: fix the connection state transitions with multichannel cifs: check reconnects for channels of active tcons too smb3: add new defines from protocol specification cifs: serialize all mount attempts cifs: quirk for STATUS_OBJECT_NAME_INVALID returned for non-ASCII dfs refs cifs: alloc_path_with_tree_prefix: do not append sep. if the path is empty cifs: clean up an inconsistent indenting cifs: free ntlmsspblob allocated in negotiate
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r--fs/cifs/transport.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 93f0e8c1ea23..8540f7c13eae 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -431,7 +431,8 @@ unmask:
* socket so the server throws away the partial SMB
*/
spin_lock(&cifs_tcp_ses_lock);
- server->tcpStatus = CifsNeedReconnect;
+ if (server->tcpStatus != CifsExiting)
+ server->tcpStatus = CifsNeedReconnect;
spin_unlock(&cifs_tcp_ses_lock);
trace_smb3_partial_send_reconnect(server->CurrentMid,
server->conn_id, server->hostname);
@@ -729,17 +730,6 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,
struct mid_q_entry **ppmidQ)
{
spin_lock(&cifs_tcp_ses_lock);
- if (ses->server->tcpStatus == CifsExiting) {
- spin_unlock(&cifs_tcp_ses_lock);
- return -ENOENT;
- }
-
- if (ses->server->tcpStatus == CifsNeedReconnect) {
- spin_unlock(&cifs_tcp_ses_lock);
- cifs_dbg(FYI, "tcp session dead - return to caller to retry\n");
- return -EAGAIN;
- }
-
if (ses->status == CifsNew) {
if ((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) &&
(in_buf->Command != SMB_COM_NEGOTIATE)) {
@@ -1059,7 +1049,10 @@ struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses)
/* round robin */
index = (uint)atomic_inc_return(&ses->chan_seq);
+
+ spin_lock(&ses->chan_lock);
index %= ses->chan_count;
+ spin_unlock(&ses->chan_lock);
return ses->chans[index].server;
}