aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorShyam Prasad N <sprasad@microsoft.com>2021-07-19 10:03:38 +0000
committerSteve French <stfrench@microsoft.com>2021-11-12 16:21:03 -0600
commit8e07757bece6e81b0b0910358ebceca3032bc6c7 (patch)
tree8b5c4218c9370299512aa4a28ac1f46b96c248f7 /fs/cifs
parentsmb3: do not setup the fscache_super_cookie until fsinfo initialized (diff)
downloadlinux-dev-8e07757bece6e81b0b0910358ebceca3032bc6c7.tar.xz
linux-dev-8e07757bece6e81b0b0910358ebceca3032bc6c7.zip
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 <sprasad@microsoft.com> Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/connect.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 084605f7ce96..498ec05ca10d 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1943,16 +1943,18 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)
ses->status);
mutex_lock(&ses->session_mutex);
- rc = cifs_negotiate_protocol(xid, ses);
- if (rc) {
- mutex_unlock(&ses->session_mutex);
- /* problem -- put our ses reference */
- cifs_put_smb_ses(ses);
- free_xid(xid);
- return ERR_PTR(rc);
- }
if (ses->need_reconnect) {
cifs_dbg(FYI, "Session needs reconnect\n");
+
+ rc = cifs_negotiate_protocol(xid, ses);
+ if (rc) {
+ mutex_unlock(&ses->session_mutex);
+ /* problem -- put our ses reference */
+ cifs_put_smb_ses(ses);
+ free_xid(xid);
+ return ERR_PTR(rc);
+ }
+
rc = cifs_setup_session(xid, ses,
ctx->local_nls);
if (rc) {