diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-28 03:13:34 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-28 03:13:34 +0200 |
commit | 7420a8c0de8d99b201aeeab6fed16ca95ebf55a5 (patch) | |
tree | 0787800f490f98ffd41b958e52ab15732335744e /fs/lockd | |
parent | fix braino in fs: do not assign default i_ino in new_inode (diff) | |
parent | locks: turn lock_flocks into a spinlock (diff) | |
download | linux-7420a8c0de8d99b201aeeab6fed16ca95ebf55a5.tar.xz linux-7420a8c0de8d99b201aeeab6fed16ca95ebf55a5.zip |
Merge branch 'flock' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl
* 'flock' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
locks: turn lock_flocks into a spinlock
fasync: re-organize fasync entry insertion to allow it under a spinlock
locks/nfsd: allocate file lock outside of spinlock
lockd: fix nlmsvc_notify_blocked locking
lockd: push lock_flocks down
Diffstat (limited to 'fs/lockd')
-rw-r--r-- | fs/lockd/svc.c | 11 | ||||
-rw-r--r-- | fs/lockd/svclock.c | 6 | ||||
-rw-r--r-- | fs/lockd/svcsubs.c | 9 |
3 files changed, 12 insertions, 14 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index b13aabc12298..abfff9d7979d 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c @@ -22,7 +22,6 @@ #include <linux/in.h> #include <linux/uio.h> #include <linux/smp.h> -#include <linux/smp_lock.h> #include <linux/mutex.h> #include <linux/kthread.h> #include <linux/freezer.h> @@ -130,15 +129,6 @@ lockd(void *vrqstp) dprintk("NFS locking service started (ver " LOCKD_VERSION ").\n"); - /* - * FIXME: it would be nice if lockd didn't spend its entire life - * running under the BKL. At the very least, it would be good to - * have someone clarify what it's intended to protect here. I've - * seen some handwavy posts about posix locking needing to be - * done under the BKL, but it's far from clear. - */ - lock_kernel(); - if (!nlm_timeout) nlm_timeout = LOCKD_DFLT_TIMEO; nlmsvc_timeout = nlm_timeout * HZ; @@ -195,7 +185,6 @@ lockd(void *vrqstp) if (nlmsvc_ops) nlmsvc_invalidate_all(); nlm_shutdown_hosts(); - unlock_kernel(); return 0; } diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 6f1ef000975a..c462d346acbd 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c @@ -700,14 +700,16 @@ nlmsvc_notify_blocked(struct file_lock *fl) struct nlm_block *block; dprintk("lockd: VFS unblock notification for block %p\n", fl); + spin_lock(&nlm_blocked_lock); list_for_each_entry(block, &nlm_blocked, b_list) { if (nlm_compare_locks(&block->b_call->a_args.lock.fl, fl)) { - nlmsvc_insert_block(block, 0); + nlmsvc_insert_block_locked(block, 0); + spin_unlock(&nlm_blocked_lock); svc_wake_up(block->b_daemon); return; } } - + spin_unlock(&nlm_blocked_lock); printk(KERN_WARNING "lockd: notification for unknown block!\n"); } diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index d0ef94cfb3da..1ca0679c80bf 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c @@ -170,6 +170,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_file *file, again: file->f_locks = 0; + lock_flocks(); /* protects i_flock list */ for (fl = inode->i_flock; fl; fl = fl->fl_next) { if (fl->fl_lmops != &nlmsvc_lock_operations) continue; @@ -181,6 +182,7 @@ again: if (match(lockhost, host)) { struct file_lock lock = *fl; + unlock_flocks(); lock.fl_type = F_UNLCK; lock.fl_start = 0; lock.fl_end = OFFSET_MAX; @@ -192,6 +194,7 @@ again: goto again; } } + unlock_flocks(); return 0; } @@ -226,10 +229,14 @@ nlm_file_inuse(struct nlm_file *file) if (file->f_count || !list_empty(&file->f_blocks) || file->f_shares) return 1; + lock_flocks(); for (fl = inode->i_flock; fl; fl = fl->fl_next) { - if (fl->fl_lmops == &nlmsvc_lock_operations) + if (fl->fl_lmops == &nlmsvc_lock_operations) { + unlock_flocks(); return 1; + } } + unlock_flocks(); file->f_locks = 0; return 0; } |