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

Commit d7b619cf authored by Steve French's avatar Steve French
Browse files

[CIFS] pSesInfo->sesSem is used as mutex. Rename it to session_mutex and


convert it to a real mutex.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 122ca007
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -205,7 +205,7 @@ struct cifsUidInfo {
struct cifsSesInfo {
struct cifsSesInfo {
	struct list_head smb_ses_list;
	struct list_head smb_ses_list;
	struct list_head tcon_list;
	struct list_head tcon_list;
	struct semaphore sesSem;
	struct mutex session_mutex;
#if 0
#if 0
	struct cifsUidInfo *uidInfo;	/* pointer to user info */
	struct cifsUidInfo *uidInfo;	/* pointer to user info */
#endif
#endif
+6 −6
Original line number Original line Diff line number Diff line
@@ -170,19 +170,19 @@ cifs_reconnect_tcon(struct cifsTconInfo *tcon, int smb_command)
	 * need to prevent multiple threads trying to simultaneously
	 * need to prevent multiple threads trying to simultaneously
	 * reconnect the same SMB session
	 * reconnect the same SMB session
	 */
	 */
	down(&ses->sesSem);
	mutex_lock(&ses->session_mutex);
	if (ses->need_reconnect)
	if (ses->need_reconnect)
		rc = cifs_setup_session(0, ses, nls_codepage);
		rc = cifs_setup_session(0, ses, nls_codepage);


	/* do we need to reconnect tcon? */
	/* do we need to reconnect tcon? */
	if (rc || !tcon->need_reconnect) {
	if (rc || !tcon->need_reconnect) {
		up(&ses->sesSem);
		mutex_unlock(&ses->session_mutex);
		goto out;
		goto out;
	}
	}


	mark_open_files_invalid(tcon);
	mark_open_files_invalid(tcon);
	rc = CIFSTCon(0, ses, tcon->treeName, tcon, nls_codepage);
	rc = CIFSTCon(0, ses, tcon->treeName, tcon, nls_codepage);
	up(&ses->sesSem);
	mutex_unlock(&ses->session_mutex);
	cFYI(1, ("reconnect tcon rc = %d", rc));
	cFYI(1, ("reconnect tcon rc = %d", rc));


	if (rc)
	if (rc)
@@ -700,13 +700,13 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
	if (!ses || !ses->server)
	if (!ses || !ses->server)
		return -EIO;
		return -EIO;


	down(&ses->sesSem);
	mutex_lock(&ses->session_mutex);
	if (ses->need_reconnect)
	if (ses->need_reconnect)
		goto session_already_dead; /* no need to send SMBlogoff if uid
		goto session_already_dead; /* no need to send SMBlogoff if uid
					      already closed due to reconnect */
					      already closed due to reconnect */
	rc = small_smb_init(SMB_COM_LOGOFF_ANDX, 2, NULL, (void **)&pSMB);
	rc = small_smb_init(SMB_COM_LOGOFF_ANDX, 2, NULL, (void **)&pSMB);
	if (rc) {
	if (rc) {
		up(&ses->sesSem);
		mutex_unlock(&ses->session_mutex);
		return rc;
		return rc;
	}
	}


@@ -721,7 +721,7 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
	pSMB->AndXCommand = 0xFF;
	pSMB->AndXCommand = 0xFF;
	rc = SendReceiveNoRsp(xid, ses, (struct smb_hdr *) pSMB, 0);
	rc = SendReceiveNoRsp(xid, ses, (struct smb_hdr *) pSMB, 0);
session_already_dead:
session_already_dead:
	up(&ses->sesSem);
	mutex_unlock(&ses->session_mutex);


	/* if session dead then we do not need to do ulogoff,
	/* if session dead then we do not need to do ulogoff,
		since server closed smb session, no sense reporting
		since server closed smb session, no sense reporting
+4 −4
Original line number Original line Diff line number Diff line
@@ -2388,13 +2388,13 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
		 */
		 */
		cifs_put_tcp_session(srvTcp);
		cifs_put_tcp_session(srvTcp);


		down(&pSesInfo->sesSem);
		mutex_lock(&pSesInfo->session_mutex);
		if (pSesInfo->need_reconnect) {
		if (pSesInfo->need_reconnect) {
			cFYI(1, ("Session needs reconnect"));
			cFYI(1, ("Session needs reconnect"));
			rc = cifs_setup_session(xid, pSesInfo,
			rc = cifs_setup_session(xid, pSesInfo,
						cifs_sb->local_nls);
						cifs_sb->local_nls);
		}
		}
		up(&pSesInfo->sesSem);
		mutex_unlock(&pSesInfo->session_mutex);
	} else if (!rc) {
	} else if (!rc) {
		cFYI(1, ("Existing smb sess not found"));
		cFYI(1, ("Existing smb sess not found"));
		pSesInfo = sesInfoAlloc();
		pSesInfo = sesInfoAlloc();
@@ -2437,12 +2437,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
		}
		}
		pSesInfo->linux_uid = volume_info->linux_uid;
		pSesInfo->linux_uid = volume_info->linux_uid;
		pSesInfo->overrideSecFlg = volume_info->secFlg;
		pSesInfo->overrideSecFlg = volume_info->secFlg;
		down(&pSesInfo->sesSem);
		mutex_lock(&pSesInfo->session_mutex);


		/* BB FIXME need to pass vol->secFlgs BB */
		/* BB FIXME need to pass vol->secFlgs BB */
		rc = cifs_setup_session(xid, pSesInfo,
		rc = cifs_setup_session(xid, pSesInfo,
					cifs_sb->local_nls);
					cifs_sb->local_nls);
		up(&pSesInfo->sesSem);
		mutex_unlock(&pSesInfo->session_mutex);
	}
	}


	/* search for existing tcon to this server share */
	/* search for existing tcon to this server share */
+1 −1
Original line number Original line Diff line number Diff line
@@ -79,7 +79,7 @@ sesInfoAlloc(void)
		++ret_buf->ses_count;
		++ret_buf->ses_count;
		INIT_LIST_HEAD(&ret_buf->smb_ses_list);
		INIT_LIST_HEAD(&ret_buf->smb_ses_list);
		INIT_LIST_HEAD(&ret_buf->tcon_list);
		INIT_LIST_HEAD(&ret_buf->tcon_list);
		init_MUTEX(&ret_buf->sesSem);
		mutex_init(&ret_buf->session_mutex);
	}
	}
	return ret_buf;
	return ret_buf;
}
}