Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af4281dc authored by Pavel Shilovsky's avatar Pavel Shilovsky
Browse files

CIFS: Move informational tcon calls to ops struct



and rename variables in cifs_mount.

Signed-off-by: default avatarPavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
parent b669f33c
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -213,6 +213,8 @@ struct smb_version_operations {
	int (*get_dfs_refer)(const unsigned int, struct cifs_ses *,
	int (*get_dfs_refer)(const unsigned int, struct cifs_ses *,
			     const char *, struct dfs_info3_param **,
			     const char *, struct dfs_info3_param **,
			     unsigned int *, const struct nls_table *, int);
			     unsigned int *, const struct nls_table *, int);
	/* informational QFS call */
	void (*qfs_tcon)(const unsigned int, struct cifs_tcon *);
};
};


struct smb_version_values {
struct smb_version_values {
+24 −27
Original line number Original line Diff line number Diff line
@@ -3600,9 +3600,9 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
{
{
	int rc;
	int rc;
	unsigned int xid;
	unsigned int xid;
	struct cifs_ses *pSesInfo;
	struct cifs_ses *ses;
	struct cifs_tcon *tcon;
	struct cifs_tcon *tcon;
	struct TCP_Server_Info *srvTcp;
	struct TCP_Server_Info *server;
	char   *full_path;
	char   *full_path;
	struct tcon_link *tlink;
	struct tcon_link *tlink;
#ifdef CONFIG_CIFS_DFS_UPCALL
#ifdef CONFIG_CIFS_DFS_UPCALL
@@ -3619,39 +3619,39 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
	if (referral_walks_count) {
	if (referral_walks_count) {
		if (tcon)
		if (tcon)
			cifs_put_tcon(tcon);
			cifs_put_tcon(tcon);
		else if (pSesInfo)
		else if (ses)
			cifs_put_smb_ses(pSesInfo);
			cifs_put_smb_ses(ses);


		free_xid(xid);
		free_xid(xid);
	}
	}
#endif
#endif
	rc = 0;
	rc = 0;
	tcon = NULL;
	tcon = NULL;
	pSesInfo = NULL;
	ses = NULL;
	srvTcp = NULL;
	server = NULL;
	full_path = NULL;
	full_path = NULL;
	tlink = NULL;
	tlink = NULL;


	xid = get_xid();
	xid = get_xid();


	/* get a reference to a tcp session */
	/* get a reference to a tcp session */
	srvTcp = cifs_get_tcp_session(volume_info);
	server = cifs_get_tcp_session(volume_info);
	if (IS_ERR(srvTcp)) {
	if (IS_ERR(server)) {
		rc = PTR_ERR(srvTcp);
		rc = PTR_ERR(server);
		bdi_destroy(&cifs_sb->bdi);
		bdi_destroy(&cifs_sb->bdi);
		goto out;
		goto out;
	}
	}


	/* get a reference to a SMB session */
	/* get a reference to a SMB session */
	pSesInfo = cifs_get_smb_ses(srvTcp, volume_info);
	ses = cifs_get_smb_ses(server, volume_info);
	if (IS_ERR(pSesInfo)) {
	if (IS_ERR(ses)) {
		rc = PTR_ERR(pSesInfo);
		rc = PTR_ERR(ses);
		pSesInfo = NULL;
		ses = NULL;
		goto mount_fail_check;
		goto mount_fail_check;
	}
	}


	/* search for existing tcon to this server share */
	/* search for existing tcon to this server share */
	tcon = cifs_get_tcon(pSesInfo, volume_info);
	tcon = cifs_get_tcon(ses, volume_info);
	if (IS_ERR(tcon)) {
	if (IS_ERR(tcon)) {
		rc = PTR_ERR(tcon);
		rc = PTR_ERR(tcon);
		tcon = NULL;
		tcon = NULL;
@@ -3672,11 +3672,9 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
	} else
	} else
		tcon->unix_ext = 0; /* server does not support them */
		tcon->unix_ext = 0; /* server does not support them */


	/* do not care if following two calls succeed - informational */
	/* do not care if a following call succeed - informational */
	if (!tcon->ipc) {
	if (!tcon->ipc && server->ops->qfs_tcon)
		CIFSSMBQFSDeviceInfo(xid, tcon);
		server->ops->qfs_tcon(xid, tcon);
		CIFSSMBQFSAttributeInfo(xid, tcon);
	}


	cifs_sb->wsize = cifs_negotiate_wsize(tcon, volume_info);
	cifs_sb->wsize = cifs_negotiate_wsize(tcon, volume_info);
	cifs_sb->rsize = cifs_negotiate_rsize(tcon, volume_info);
	cifs_sb->rsize = cifs_negotiate_rsize(tcon, volume_info);
@@ -3694,8 +3692,8 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
	 * Chase the referral if found, otherwise continue normally.
	 * Chase the referral if found, otherwise continue normally.
	 */
	 */
	if (referral_walks_count == 0) {
	if (referral_walks_count == 0) {
		int refrc = expand_dfs_referral(xid, pSesInfo, volume_info,
		int refrc = expand_dfs_referral(xid, ses, volume_info, cifs_sb,
						cifs_sb, false);
						false);
		if (!refrc) {
		if (!refrc) {
			referral_walks_count++;
			referral_walks_count++;
			goto try_mount_again;
			goto try_mount_again;
@@ -3733,8 +3731,7 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
			goto mount_fail_check;
			goto mount_fail_check;
		}
		}


		rc = expand_dfs_referral(xid, pSesInfo, volume_info, cifs_sb,
		rc = expand_dfs_referral(xid, ses, volume_info, cifs_sb, true);
					 true);


		if (!rc) {
		if (!rc) {
			referral_walks_count++;
			referral_walks_count++;
@@ -3756,7 +3753,7 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
		goto mount_fail_check;
		goto mount_fail_check;
	}
	}


	tlink->tl_uid = pSesInfo->linux_uid;
	tlink->tl_uid = ses->linux_uid;
	tlink->tl_tcon = tcon;
	tlink->tl_tcon = tcon;
	tlink->tl_time = jiffies;
	tlink->tl_time = jiffies;
	set_bit(TCON_LINK_MASTER, &tlink->tl_flags);
	set_bit(TCON_LINK_MASTER, &tlink->tl_flags);
@@ -3777,10 +3774,10 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
		/* up accidentally freeing someone elses tcon struct */
		/* up accidentally freeing someone elses tcon struct */
		if (tcon)
		if (tcon)
			cifs_put_tcon(tcon);
			cifs_put_tcon(tcon);
		else if (pSesInfo)
		else if (ses)
			cifs_put_smb_ses(pSesInfo);
			cifs_put_smb_ses(ses);
		else
		else
			cifs_put_tcp_session(srvTcp);
			cifs_put_tcp_session(server);
		bdi_destroy(&cifs_sb->bdi);
		bdi_destroy(&cifs_sb->bdi);
	}
	}


+8 −0
Original line number Original line Diff line number Diff line
@@ -410,6 +410,13 @@ cifs_negotiate(const unsigned int xid, struct cifs_ses *ses)
	return rc;
	return rc;
}
}


static void
cifs_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon)
{
	CIFSSMBQFSDeviceInfo(xid, tcon);
	CIFSSMBQFSAttributeInfo(xid, tcon);
}

struct smb_version_operations smb1_operations = {
struct smb_version_operations smb1_operations = {
	.send_cancel = send_nt_cancel,
	.send_cancel = send_nt_cancel,
	.compare_fids = cifs_compare_fids,
	.compare_fids = cifs_compare_fids,
@@ -435,6 +442,7 @@ struct smb_version_operations smb1_operations = {
	.tree_connect = CIFSTCon,
	.tree_connect = CIFSTCon,
	.tree_disconnect = CIFSSMBTDis,
	.tree_disconnect = CIFSSMBTDis,
	.get_dfs_refer = CIFSGetDFSRefer,
	.get_dfs_refer = CIFSGetDFSRefer,
	.qfs_tcon = cifs_qfs_tcon,
};
};


struct smb_version_values smb1_values = {
struct smb_version_values smb1_values = {