Skip to content

Commit b2fe4a8

Browse files
Paulo Alcantarasmfrench
authored andcommitted
smb: client: get rid of @NLSC param in cifs_tree_connect()
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) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 28ec614 commit b2fe4a8

File tree

5 files changed

+15
-20
lines changed

5 files changed

+15
-20
lines changed

fs/smb/client/cifsproto.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,7 @@ extern void cifs_move_llist(struct list_head *source, struct list_head *dest);
314314
extern void cifs_free_llist(struct list_head *llist);
315315
extern void cifs_del_lock_waiters(struct cifsLockInfo *lock);
316316

317-
extern int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon,
318-
const struct nls_table *nlsc);
317+
int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon);
319318

320319
extern int cifs_negotiate_protocol(const unsigned int xid,
321320
struct cifs_ses *ses,

fs/smb/client/cifssmb.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,9 @@ static struct {
7070
static int
7171
cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
7272
{
73-
int rc;
74-
struct cifs_ses *ses;
7573
struct TCP_Server_Info *server;
76-
struct nls_table *nls_codepage = NULL;
74+
struct cifs_ses *ses;
75+
int rc;
7776

7877
/*
7978
* SMBs NegProt, SessSetup, uLogoff do not have tcon yet so check for
@@ -131,8 +130,6 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
131130
}
132131
spin_unlock(&server->srv_lock);
133132

134-
nls_codepage = ses->local_nls;
135-
136133
/*
137134
* need to prevent multiple threads trying to simultaneously
138135
* reconnect the same SMB session
@@ -156,7 +153,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
156153

157154
rc = cifs_negotiate_protocol(0, ses, server);
158155
if (!rc)
159-
rc = cifs_setup_session(0, ses, server, nls_codepage);
156+
rc = cifs_setup_session(0, ses, server, ses->local_nls);
160157

161158
/* do we need to reconnect tcon? */
162159
if (rc || !tcon->need_reconnect) {
@@ -166,7 +163,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
166163

167164
skip_sess_setup:
168165
cifs_mark_open_files_invalid(tcon);
169-
rc = cifs_tree_connect(0, tcon, nls_codepage);
166+
rc = cifs_tree_connect(0, tcon);
170167
mutex_unlock(&ses->session_mutex);
171168
cifs_dbg(FYI, "reconnect tcon rc = %d\n", rc);
172169

fs/smb/client/connect.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4344,10 +4344,10 @@ cifs_prune_tlinks(struct work_struct *work)
43444344
}
43454345

43464346
#ifndef CONFIG_CIFS_DFS_UPCALL
4347-
int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc)
4347+
int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon)
43484348
{
4349-
int rc;
43504349
const struct smb_version_operations *ops = tcon->ses->server->ops;
4350+
int rc;
43514351

43524352
/* only send once per connect */
43534353
spin_lock(&tcon->tc_lock);
@@ -4370,7 +4370,8 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
43704370
tcon->status = TID_IN_TCON;
43714371
spin_unlock(&tcon->tc_lock);
43724372

4373-
rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, tcon, nlsc);
4373+
rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name,
4374+
tcon, tcon->ses->local_nls);
43744375
if (rc) {
43754376
spin_lock(&tcon->tc_lock);
43764377
if (tcon->status == TID_IN_TCON)

fs/smb/client/dfs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ static int tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *tco
546546
return rc;
547547
}
548548

549-
int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc)
549+
int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon)
550550
{
551551
int rc;
552552
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
588588
cifs_server_lock(server);
589589
scnprintf(tree, MAX_TREE_SIZE, "\\\\%s\\IPC$", server->hostname);
590590
cifs_server_unlock(server);
591-
rc = ops->tree_connect(xid, tcon->ses, tree, tcon, nlsc);
591+
rc = ops->tree_connect(xid, tcon->ses, tree,
592+
tcon, tcon->ses->local_nls);
592593
goto out;
593594
}
594595

fs/smb/client/smb2pdu.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,9 @@ static int
216216
smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
217217
struct TCP_Server_Info *server, bool from_reconnect)
218218
{
219-
int rc = 0;
220-
struct nls_table *nls_codepage = NULL;
221219
struct cifs_ses *ses;
222220
int xid;
221+
int rc = 0;
223222

224223
/*
225224
* SMB2s NegProt, SessSetup, Logoff do not have tcon yet so
@@ -334,8 +333,6 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
334333
}
335334
spin_unlock(&server->srv_lock);
336335

337-
nls_codepage = ses->local_nls;
338-
339336
/*
340337
* need to prevent multiple threads trying to simultaneously
341338
* reconnect the same SMB session
@@ -372,7 +369,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
372369
}
373370
}
374371

375-
rc = cifs_setup_session(0, ses, server, nls_codepage);
372+
rc = cifs_setup_session(0, ses, server, ses->local_nls);
376373
if ((rc == -EACCES) || (rc == -EKEYEXPIRED) || (rc == -EKEYREVOKED)) {
377374
/*
378375
* Try alternate password for next reconnect (key rotation
@@ -406,7 +403,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
406403
if (tcon->use_persistent)
407404
tcon->need_reopen_files = true;
408405

409-
rc = cifs_tree_connect(0, tcon, nls_codepage);
406+
rc = cifs_tree_connect(0, tcon);
410407

411408
cifs_dbg(FYI, "reconnect tcon rc = %d\n", rc);
412409
if (rc) {

0 commit comments

Comments
 (0)