Skip to content

Commit 8e07757

Browse files
sprasad-microsoftsmfrench
authored andcommitted
cifs: do not negotiate session if session already exists
In cifs_get_smb_ses, if we find an existing matching session, we should not send a negotiate request for the session if a session reconnect is not necessary. Signed-off-by: Shyam Prasad N <[email protected]> Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 0210274 commit 8e07757

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

fs/cifs/connect.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,16 +1943,18 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)
19431943
ses->status);
19441944

19451945
mutex_lock(&ses->session_mutex);
1946-
rc = cifs_negotiate_protocol(xid, ses);
1947-
if (rc) {
1948-
mutex_unlock(&ses->session_mutex);
1949-
/* problem -- put our ses reference */
1950-
cifs_put_smb_ses(ses);
1951-
free_xid(xid);
1952-
return ERR_PTR(rc);
1953-
}
19541946
if (ses->need_reconnect) {
19551947
cifs_dbg(FYI, "Session needs reconnect\n");
1948+
1949+
rc = cifs_negotiate_protocol(xid, ses);
1950+
if (rc) {
1951+
mutex_unlock(&ses->session_mutex);
1952+
/* problem -- put our ses reference */
1953+
cifs_put_smb_ses(ses);
1954+
free_xid(xid);
1955+
return ERR_PTR(rc);
1956+
}
1957+
19561958
rc = cifs_setup_session(xid, ses,
19571959
ctx->local_nls);
19581960
if (rc) {

0 commit comments

Comments
 (0)