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

Commit f0a71eb8 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French
Browse files

cifs: fix fh_mutex locking in cifs_reopen_file



Fixes a regression caused by commit a6ce4932

When this lock was converted to a mutex, the locks were turned into
unlocks and vice-versa.

Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Acked-by: default avatarShirish Pargaonkar <shirishp@us.ibm.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 4075ea8c
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -493,9 +493,9 @@ static int cifs_reopen_file(struct file *file, bool can_flush)
		return -EBADF;

	xid = GetXid();
	mutex_unlock(&pCifsFile->fh_mutex);
	if (!pCifsFile->invalidHandle) {
	mutex_lock(&pCifsFile->fh_mutex);
	if (!pCifsFile->invalidHandle) {
		mutex_unlock(&pCifsFile->fh_mutex);
		rc = 0;
		FreeXid(xid);
		return rc;
@@ -527,7 +527,7 @@ static int cifs_reopen_file(struct file *file, bool can_flush)
	if (full_path == NULL) {
		rc = -ENOMEM;
reopen_error_exit:
		mutex_lock(&pCifsFile->fh_mutex);
		mutex_unlock(&pCifsFile->fh_mutex);
		FreeXid(xid);
		return rc;
	}
@@ -569,14 +569,14 @@ static int cifs_reopen_file(struct file *file, bool can_flush)
			 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
				CIFS_MOUNT_MAP_SPECIAL_CHR);
	if (rc) {
		mutex_lock(&pCifsFile->fh_mutex);
		mutex_unlock(&pCifsFile->fh_mutex);
		cFYI(1, ("cifs_open returned 0x%x", rc));
		cFYI(1, ("oplock: %d", oplock));
	} else {
reopen_success:
		pCifsFile->netfid = netfid;
		pCifsFile->invalidHandle = false;
		mutex_lock(&pCifsFile->fh_mutex);
		mutex_unlock(&pCifsFile->fh_mutex);
		pCifsInode = CIFS_I(inode);
		if (pCifsInode) {
			if (can_flush) {