aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/misc.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2010-10-15 15:34:03 -0400
committerSteve French <sfrench@us.ibm.com>2010-10-17 21:32:01 -0400
commit4477288a103631980750c86547d1fd54bfd2ba7d (patch)
treee0d56476a740f043f6687e063ff88d2982b4c444 /fs/cifs/misc.c
parent7a16f1961a5c61d1f60d9e0d3d171cf7793fb5cb (diff)
cifs: convert GlobalSMBSeslock from a rwlock to regular spinlock
Convert this lock to a regular spinlock A rwlock_t offers little value here. It's more expensive than a regular spinlock unless you have a fairly large section of code that runs under the read lock and can benefit from the concurrency. Additionally, we need to ensure that the refcounting for files isn't racy and to do that we need to lock areas that can increment it for write. That means that the areas that can actually use a read_lock are very few and relatively infrequently used. While we're at it, change the name to something easier to type, and fix a bug in find_writable_file. cifsFileInfo_put can sleep and shouldn't be called while holding the lock. Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/misc.c')
-rw-r--r--fs/cifs/misc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 9bac3e74b314..de6073cccd9c 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -560,7 +560,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
560 continue; 560 continue;
561 561
562 cifs_stats_inc(&tcon->num_oplock_brks); 562 cifs_stats_inc(&tcon->num_oplock_brks);
563 read_lock(&GlobalSMBSeslock); 563 spin_lock(&cifs_file_list_lock);
564 list_for_each(tmp2, &tcon->openFileList) { 564 list_for_each(tmp2, &tcon->openFileList) {
565 netfile = list_entry(tmp2, struct cifsFileInfo, 565 netfile = list_entry(tmp2, struct cifsFileInfo,
566 tlist); 566 tlist);
@@ -572,7 +572,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
572 * closed anyway. 572 * closed anyway.
573 */ 573 */
574 if (netfile->closePend) { 574 if (netfile->closePend) {
575 read_unlock(&GlobalSMBSeslock); 575 spin_unlock(&cifs_file_list_lock);
576 read_unlock(&cifs_tcp_ses_lock); 576 read_unlock(&cifs_tcp_ses_lock);
577 return true; 577 return true;
578 } 578 }
@@ -594,11 +594,11 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
594 cifs_oplock_break_get(netfile); 594 cifs_oplock_break_get(netfile);
595 netfile->oplock_break_cancelled = false; 595 netfile->oplock_break_cancelled = false;
596 596
597 read_unlock(&GlobalSMBSeslock); 597 spin_unlock(&cifs_file_list_lock);
598 read_unlock(&cifs_tcp_ses_lock); 598 read_unlock(&cifs_tcp_ses_lock);
599 return true; 599 return true;
600 } 600 }
601 read_unlock(&GlobalSMBSeslock); 601 spin_unlock(&cifs_file_list_lock);
602 read_unlock(&cifs_tcp_ses_lock); 602 read_unlock(&cifs_tcp_ses_lock);
603 cFYI(1, "No matching file for oplock break"); 603 cFYI(1, "No matching file for oplock break");
604 return true; 604 return true;