smb: client: get rid of @nlsc param in cifs_tree_connect()
authorPaulo Alcantara <pc@manguebit.com>
Tue, 26 Nov 2024 20:40:11 +0000 (17:40 -0300)
committerSteve French <stfrench@microsoft.com>
Wed, 27 Nov 2024 00:46:19 +0000 (18:46 -0600)
We can access local_nls directly from @tcon->ses, so there is no need
to pass it as parameter in cifs_tree_connect().

Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifsproto.h
fs/smb/client/cifssmb.c
fs/smb/client/connect.c
fs/smb/client/dfs.c
fs/smb/client/smb2pdu.c

index c5be95f..bbaaf16 100644 (file)
@@ -314,8 +314,7 @@ extern void cifs_move_llist(struct list_head *source, struct list_head *dest);
 extern void cifs_free_llist(struct list_head *llist);
 extern void cifs_del_lock_waiters(struct cifsLockInfo *lock);
 
-extern int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon,
-                            const struct nls_table *nlsc);
+int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon);
 
 extern int cifs_negotiate_protocol(const unsigned int xid,
                                   struct cifs_ses *ses,
index 4858331..98abf14 100644 (file)
@@ -70,10 +70,9 @@ static struct {
 static int
 cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
 {
-       int rc;
-       struct cifs_ses *ses;
        struct TCP_Server_Info *server;
-       struct nls_table *nls_codepage = NULL;
+       struct cifs_ses *ses;
+       int rc;
 
        /*
         * SMBs NegProt, SessSetup, uLogoff do not have tcon yet so check for
@@ -131,8 +130,6 @@ again:
        }
        spin_unlock(&server->srv_lock);
 
-       nls_codepage = ses->local_nls;
-
        /*
         * need to prevent multiple threads trying to simultaneously
         * reconnect the same SMB session
@@ -156,7 +153,7 @@ again:
 
        rc = cifs_negotiate_protocol(0, ses, server);
        if (!rc)
-               rc = cifs_setup_session(0, ses, server, nls_codepage);
+               rc = cifs_setup_session(0, ses, server, ses->local_nls);
 
        /* do we need to reconnect tcon? */
        if (rc || !tcon->need_reconnect) {
@@ -166,7 +163,7 @@ again:
 
 skip_sess_setup:
        cifs_mark_open_files_invalid(tcon);
-       rc = cifs_tree_connect(0, tcon, nls_codepage);
+       rc = cifs_tree_connect(0, tcon);
        mutex_unlock(&ses->session_mutex);
        cifs_dbg(FYI, "reconnect tcon rc = %d\n", rc);
 
index fb6a2ee..0afb923 100644 (file)
@@ -4344,10 +4344,10 @@ cifs_prune_tlinks(struct work_struct *work)
 }
 
 #ifndef CONFIG_CIFS_DFS_UPCALL
-int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc)
+int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon)
 {
-       int rc;
        const struct smb_version_operations *ops = tcon->ses->server->ops;
+       int rc;
 
        /* only send once per connect */
        spin_lock(&tcon->tc_lock);
@@ -4370,7 +4370,8 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
        tcon->status = TID_IN_TCON;
        spin_unlock(&tcon->tc_lock);
 
-       rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, tcon, nlsc);
+       rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name,
+                              tcon, tcon->ses->local_nls);
        if (rc) {
                spin_lock(&tcon->tc_lock);
                if (tcon->status == TID_IN_TCON)
index 3f6077c..5dc7708 100644 (file)
@@ -546,7 +546,7 @@ static int tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *tco
        return rc;
 }
 
-int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc)
+int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon)
 {
        int rc;
        struct TCP_Server_Info *server = tcon->ses->server;
@@ -588,7 +588,8 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
                cifs_server_lock(server);
                scnprintf(tree, MAX_TREE_SIZE, "\\\\%s\\IPC$", server->hostname);
                cifs_server_unlock(server);
-               rc = ops->tree_connect(xid, tcon->ses, tree, tcon, nlsc);
+               rc = ops->tree_connect(xid, tcon->ses, tree,
+                                      tcon, tcon->ses->local_nls);
                goto out;
        }
 
index 6d4c48b..2f62178 100644 (file)
@@ -216,10 +216,9 @@ static int
 smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
               struct TCP_Server_Info *server, bool from_reconnect)
 {
-       int rc = 0;
-       struct nls_table *nls_codepage = NULL;
        struct cifs_ses *ses;
        int xid;
+       int rc = 0;
 
        /*
         * SMB2s NegProt, SessSetup, Logoff do not have tcon yet so
@@ -334,8 +333,6 @@ again:
        }
        spin_unlock(&server->srv_lock);
 
-       nls_codepage = ses->local_nls;
-
        /*
         * need to prevent multiple threads trying to simultaneously
         * reconnect the same SMB session
@@ -372,7 +369,7 @@ again:
                        }
                }
 
-               rc = cifs_setup_session(0, ses, server, nls_codepage);
+               rc = cifs_setup_session(0, ses, server, ses->local_nls);
                if ((rc == -EACCES) || (rc == -EKEYEXPIRED) || (rc == -EKEYREVOKED)) {
                        /*
                         * Try alternate password for next reconnect (key rotation
@@ -406,7 +403,7 @@ skip_sess_setup:
        if (tcon->use_persistent)
                tcon->need_reopen_files = true;
 
-       rc = cifs_tree_connect(0, tcon, nls_codepage);
+       rc = cifs_tree_connect(0, tcon);
 
        cifs_dbg(FYI, "reconnect tcon rc = %d\n", rc);
        if (rc) {