aboutsummaryrefslogtreecommitdiff
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorShyam Prasad N <sprasad@microsoft.com>2022-01-16 13:38:14 +0000
committerSteve French <stfrench@microsoft.com>2022-01-19 11:10:55 -0600
commitc1604da708d345a1ca1cf6a5537d503b14aa4787 (patch)
tree1b85cb50f937532b3d9db550f629ac5d1091edb7 /fs/cifs/connect.c
parentece0767641740c7eea7aee5a332728e115b00eab (diff)
cifs: make status checks in version independent callers
The status of tcp session, smb session and tcon have the same flow, irrespective of the SMB version used. Hence these status checks and updates should happen in the version independent callers of these commands. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 6740a7c39df3..0a35503b7b46 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3770,10 +3770,6 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
if (rc == 0) {
bool is_unicode;
- spin_lock(&cifs_tcp_ses_lock);
- tcon->tidStatus = CifsGood;
- spin_unlock(&cifs_tcp_ses_lock);
- tcon->need_reconnect = false;
tcon->tid = smb_buffer_response->Tid;
bcc_ptr = pByteArea(smb_buffer_response);
bytes_left = get_bcc(smb_buffer_response);
@@ -3949,7 +3945,14 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
spin_lock(&cifs_tcp_ses_lock);
if (server->tcpStatus == CifsInSessSetup)
server->tcpStatus = CifsGood;
+ /* Even if one channel is active, session is in good state */
+ if (ses->status == CifsInSessSetup)
+ ses->status = CifsGood;
spin_unlock(&cifs_tcp_ses_lock);
+
+ spin_lock(&ses->chan_lock);
+ cifs_chan_clear_need_reconnect(ses, server);
+ spin_unlock(&ses->chan_lock);
}
return rc;
@@ -4461,8 +4464,15 @@ out:
if (rc) {
spin_lock(&cifs_tcp_ses_lock);
- tcon->tidStatus = CifsNeedTcon;
+ if (tcon->tidStatus == CifsInTcon)
+ tcon->tidStatus = CifsNeedTcon;
+ spin_unlock(&cifs_tcp_ses_lock);
+ } else {
+ spin_lock(&cifs_tcp_ses_lock);
+ if (tcon->tidStatus == CifsInTcon)
+ tcon->tidStatus = CifsGood;
spin_unlock(&cifs_tcp_ses_lock);
+ tcon->need_reconnect = false;
}
return rc;
@@ -4487,8 +4497,15 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc);
if (rc) {
spin_lock(&cifs_tcp_ses_lock);
- tcon->tidStatus = CifsNeedTcon;
+ if (tcon->tidStatus == CifsInTcon)
+ tcon->tidStatus = CifsNeedTcon;
spin_unlock(&cifs_tcp_ses_lock);
+ } else {
+ spin_lock(&cifs_tcp_ses_lock);
+ if (tcon->tidStatus == CifsInTcon)
+ tcon->tidStatus = CifsGood;
+ spin_unlock(&cifs_tcp_ses_lock);
+ tcon->need_reconnect = false;
}
return rc;