aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-09-18 09:09:31 -0400
committerArnd Bergmann <arnd@arndb.de>2010-10-05 05:02:04 -0400
commitb89f432133851a01c0d28822f11cbdcc15781a75 (patch)
treea3e9ba638a9b746985148f4525335d360ec7da56 /fs/nfs/nfs4state.c
parent2e54eb96e2c801f33d95b5dade15212ac4d6c4a5 (diff)
fs/locks.c: prepare for BKL removal
This prepares the removal of the big kernel lock from the file locking code. We still use the BKL as long as fs/lockd uses it and ceph might sleep, but we can flip the definition to a private spinlock as soon as that's done. All users outside of fs/lockd get converted to use lock_flocks() instead of lock_kernel() where appropriate. Based on an earlier patch to use a spinlock from Matthew Wilcox, who has attempted this a few times before, the earliest patch from over 10 years ago turned it into a semaphore, which ended up being slower than the BKL and was subsequently reverted. Someone should do some serious performance testing when this becomes a spinlock, since this has caused problems before. Using a spinlock should be at least as good as the BKL in theory, but who knows... Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Matthew Wilcox <willy@linux.intel.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Miklos Szeredi <mszeredi@suse.cz> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: John Kacur <jkacur@redhat.com> Cc: Sage Weil <sage@newdream.net> Cc: linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 3e2f19b04c06..96524c5dca6b 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -40,7 +40,7 @@
40 40
41#include <linux/kernel.h> 41#include <linux/kernel.h>
42#include <linux/slab.h> 42#include <linux/slab.h>
43#include <linux/smp_lock.h> 43#include <linux/fs.h>
44#include <linux/nfs_fs.h> 44#include <linux/nfs_fs.h>
45#include <linux/nfs_idmap.h> 45#include <linux/nfs_idmap.h>
46#include <linux/kthread.h> 46#include <linux/kthread.h>
@@ -970,13 +970,13 @@ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_
970 /* Guard against delegation returns and new lock/unlock calls */ 970 /* Guard against delegation returns and new lock/unlock calls */
971 down_write(&nfsi->rwsem); 971 down_write(&nfsi->rwsem);
972 /* Protect inode->i_flock using the BKL */ 972 /* Protect inode->i_flock using the BKL */
973 lock_kernel(); 973 lock_flocks();
974 for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) { 974 for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) {
975 if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK))) 975 if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK)))
976 continue; 976 continue;
977 if (nfs_file_open_context(fl->fl_file)->state != state) 977 if (nfs_file_open_context(fl->fl_file)->state != state)
978 continue; 978 continue;
979 unlock_kernel(); 979 unlock_flocks();
980 status = ops->recover_lock(state, fl); 980 status = ops->recover_lock(state, fl);
981 switch (status) { 981 switch (status) {
982 case 0: 982 case 0:
@@ -1003,9 +1003,9 @@ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_
1003 /* kill_proc(fl->fl_pid, SIGLOST, 1); */ 1003 /* kill_proc(fl->fl_pid, SIGLOST, 1); */
1004 status = 0; 1004 status = 0;
1005 } 1005 }
1006 lock_kernel(); 1006 lock_flocks();
1007 } 1007 }
1008 unlock_kernel(); 1008 unlock_flocks();
1009out: 1009out:
1010 up_write(&nfsi->rwsem); 1010 up_write(&nfsi->rwsem);
1011 return status; 1011 return status;