Commit b2fe4a8f authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French
Browse files

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: default avatarPaulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 28ec614f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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,
+4 −7
Original line number Diff line number Diff line
@@ -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 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
	}
	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 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)

	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 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)

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);

+4 −3
Original line number Diff line number Diff line
@@ -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)
+3 −2
Original line number Diff line number Diff line
@@ -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;
	}

+3 −6
Original line number Diff line number Diff line
@@ -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 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
	}
	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 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
			}
		}

		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 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
	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) {