Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 464

kernel-2.6.18-238.el5.src.rpm

From: Jeff Layton <jlayton@redhat.com>
Date: Mon, 26 Oct 2009 15:54:21 -0400
Subject: [cifs] take GlobalSMBSes_lock as read-only
Message-id: <1256572464-27293-7-git-send-email-jlayton@redhat.com>
Patchwork-id: 21216
O-Subject: [RHEL5.5 PATCH 6/9] BZ#531005: cifs: take read lock on
	GlobalSMBSes_lock in is_valid_oplock_break
Bugzilla: 531005
RH-Acked-by: Steve Dickson <SteveD@redhat.com>
RH-Acked-by: Peter Staubach <staubach@redhat.com>

...rather than a write lock. It doesn't change the list so a read lock
should be sufficient.

Signed-off-by: Jeff Layton <jlayton@redhat.com>

diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 2ed92d0..e092c5c 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -587,14 +587,14 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
 				continue;
 
 			cifs_stats_inc(&tcon->num_oplock_brks);
-			write_lock(&GlobalSMBSeslock);
+			read_lock(&GlobalSMBSeslock);
 			list_for_each(tmp2, &tcon->openFileList) {
 				netfile = list_entry(tmp2, struct cifsFileInfo,
 						     tlist);
 				if (pSMB->Fid != netfile->netfid)
 					continue;
 
-				write_unlock(&GlobalSMBSeslock);
+				read_unlock(&GlobalSMBSeslock);
 				read_unlock(&cifs_tcp_ses_lock);
 				cFYI(1, ("file id match, oplock break"));
 				pCifsInode = CIFS_I(netfile->pInode);
@@ -609,7 +609,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
 
 				return true;
 			}
-			write_unlock(&GlobalSMBSeslock);
+			read_unlock(&GlobalSMBSeslock);
 			read_unlock(&cifs_tcp_ses_lock);
 			cFYI(1, ("No matching file for oplock break"));
 			return true;