diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-10-26 22:55:40 +0200 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2010-10-27 21:39:39 +0200 |
commit | 763641d81202834e9d64de2019d1edec12868f4f (patch) | |
tree | cabbf932e3f6676bfbce6be27744795700011bfb /fs/lockd/svcsubs.c | |
parent | f9ba5375a8aae4aeea6be15df77e24707a429812 (diff) | |
download | op-kernel-dev-763641d81202834e9d64de2019d1edec12868f4f.zip op-kernel-dev-763641d81202834e9d64de2019d1edec12868f4f.tar.gz |
lockd: push lock_flocks down
lockd should use lock_flocks() instead of lock_kernel()
to lock against posix locks accessing the i_flock list.
This is a prerequisite to turning lock_flocks into a
spinlock.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/lockd/svcsubs.c')
-rw-r--r-- | fs/lockd/svcsubs.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index d0ef94c..1ca0679 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; } |