Commit c1604da7 authored by Shyam Prasad N's avatar Shyam Prasad N Committed by Steve French

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: default avatarShyam Prasad N <sprasad@microsoft.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent ece07676
...@@ -3770,10 +3770,6 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses, ...@@ -3770,10 +3770,6 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
if (rc == 0) { if (rc == 0) {
bool is_unicode; 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; tcon->tid = smb_buffer_response->Tid;
bcc_ptr = pByteArea(smb_buffer_response); bcc_ptr = pByteArea(smb_buffer_response);
bytes_left = get_bcc(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, ...@@ -3949,7 +3945,14 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (server->tcpStatus == CifsInSessSetup) if (server->tcpStatus == CifsInSessSetup)
server->tcpStatus = CifsGood; 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_unlock(&cifs_tcp_ses_lock);
spin_lock(&ses->chan_lock);
cifs_chan_clear_need_reconnect(ses, server);
spin_unlock(&ses->chan_lock);
} }
return rc; return rc;
...@@ -4461,8 +4464,15 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru ...@@ -4461,8 +4464,15 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
if (rc) { if (rc) {
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (tcon->tidStatus == CifsInTcon)
tcon->tidStatus = CifsNeedTcon; tcon->tidStatus = CifsNeedTcon;
spin_unlock(&cifs_tcp_ses_lock); 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; return rc;
...@@ -4487,8 +4497,15 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru ...@@ -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); rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc);
if (rc) { if (rc) {
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
if (tcon->tidStatus == CifsInTcon)
tcon->tidStatus = CifsNeedTcon; tcon->tidStatus = CifsNeedTcon;
spin_unlock(&cifs_tcp_ses_lock); 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; return rc;
......
...@@ -1052,15 +1052,6 @@ sess_establish_session(struct sess_data *sess_data) ...@@ -1052,15 +1052,6 @@ sess_establish_session(struct sess_data *sess_data)
mutex_unlock(&server->srv_mutex); mutex_unlock(&server->srv_mutex);
cifs_dbg(FYI, "CIFS session established successfully\n"); cifs_dbg(FYI, "CIFS session established successfully\n");
spin_lock(&ses->chan_lock);
cifs_chan_clear_need_reconnect(ses, server);
spin_unlock(&ses->chan_lock);
/* Even if one channel is active, session is in good state */
spin_lock(&cifs_tcp_ses_lock);
ses->status = CifsGood;
spin_unlock(&cifs_tcp_ses_lock);
return 0; return 0;
} }
......
...@@ -1386,16 +1386,6 @@ SMB2_sess_establish_session(struct SMB2_sess_data *sess_data) ...@@ -1386,16 +1386,6 @@ SMB2_sess_establish_session(struct SMB2_sess_data *sess_data)
mutex_unlock(&server->srv_mutex); mutex_unlock(&server->srv_mutex);
cifs_dbg(FYI, "SMB2/3 session established successfully\n"); cifs_dbg(FYI, "SMB2/3 session established successfully\n");
spin_lock(&ses->chan_lock);
cifs_chan_clear_need_reconnect(ses, server);
spin_unlock(&ses->chan_lock);
/* Even if one channel is active, session is in good state */
spin_lock(&cifs_tcp_ses_lock);
ses->status = CifsGood;
spin_unlock(&cifs_tcp_ses_lock);
return rc; return rc;
} }
...@@ -1923,10 +1913,6 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, ...@@ -1923,10 +1913,6 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
tcon->share_flags = le32_to_cpu(rsp->ShareFlags); tcon->share_flags = le32_to_cpu(rsp->ShareFlags);
tcon->capabilities = rsp->Capabilities; /* we keep caps little endian */ tcon->capabilities = rsp->Capabilities; /* we keep caps little endian */
tcon->maximal_access = le32_to_cpu(rsp->MaximalAccess); tcon->maximal_access = le32_to_cpu(rsp->MaximalAccess);
spin_lock(&cifs_tcp_ses_lock);
tcon->tidStatus = CifsGood;
spin_unlock(&cifs_tcp_ses_lock);
tcon->need_reconnect = false;
tcon->tid = le32_to_cpu(rsp->hdr.Id.SyncId.TreeId); tcon->tid = le32_to_cpu(rsp->hdr.Id.SyncId.TreeId);
strlcpy(tcon->treeName, tree, sizeof(tcon->treeName)); strlcpy(tcon->treeName, tree, sizeof(tcon->treeName));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment