aboutsummaryrefslogtreecommitdiffstats
path: root/fs/locks.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/locks.c')
-rw-r--r--fs/locks.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 250ef53d25ef..909eab8fb1d0 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -154,7 +154,7 @@ static struct file_lock *locks_alloc_lock(void)
154} 154}
155 155
156/* Free a lock which is not in use. */ 156/* Free a lock which is not in use. */
157static inline void locks_free_lock(struct file_lock *fl) 157static void locks_free_lock(struct file_lock *fl)
158{ 158{
159 if (fl == NULL) { 159 if (fl == NULL) {
160 BUG(); 160 BUG();
@@ -475,8 +475,7 @@ static inline int locks_overlap(struct file_lock *fl1, struct file_lock *fl2)
475/* 475/*
476 * Check whether two locks have the same owner. 476 * Check whether two locks have the same owner.
477 */ 477 */
478static inline int 478static int posix_same_owner(struct file_lock *fl1, struct file_lock *fl2)
479posix_same_owner(struct file_lock *fl1, struct file_lock *fl2)
480{ 479{
481 if (fl1->fl_lmops && fl1->fl_lmops->fl_compare_owner) 480 if (fl1->fl_lmops && fl1->fl_lmops->fl_compare_owner)
482 return fl2->fl_lmops == fl1->fl_lmops && 481 return fl2->fl_lmops == fl1->fl_lmops &&
@@ -487,7 +486,7 @@ posix_same_owner(struct file_lock *fl1, struct file_lock *fl2)
487/* Remove waiter from blocker's block list. 486/* Remove waiter from blocker's block list.
488 * When blocker ends up pointing to itself then the list is empty. 487 * When blocker ends up pointing to itself then the list is empty.
489 */ 488 */
490static inline void __locks_delete_block(struct file_lock *waiter) 489static void __locks_delete_block(struct file_lock *waiter)
491{ 490{
492 list_del_init(&waiter->fl_block); 491 list_del_init(&waiter->fl_block);
493 list_del_init(&waiter->fl_link); 492 list_del_init(&waiter->fl_link);
@@ -1958,22 +1957,18 @@ EXPORT_SYMBOL(posix_block_lock);
1958 * 1957 *
1959 * lockd needs to block waiting for locks. 1958 * lockd needs to block waiting for locks.
1960 */ 1959 */
1961void 1960int
1962posix_unblock_lock(struct file *filp, struct file_lock *waiter) 1961posix_unblock_lock(struct file *filp, struct file_lock *waiter)
1963{ 1962{
1964 /* 1963 int status = 0;
1965 * A remote machine may cancel the lock request after it's been 1964
1966 * granted locally. If that happens, we need to delete the lock.
1967 */
1968 lock_kernel(); 1965 lock_kernel();
1969 if (waiter->fl_next) { 1966 if (waiter->fl_next)
1970 __locks_delete_block(waiter); 1967 __locks_delete_block(waiter);
1971 unlock_kernel(); 1968 else
1972 } else { 1969 status = -ENOENT;
1973 unlock_kernel(); 1970 unlock_kernel();
1974 waiter->fl_type = F_UNLCK; 1971 return status;
1975 posix_lock_file(filp, waiter);
1976 }
1977} 1972}
1978 1973
1979EXPORT_SYMBOL(posix_unblock_lock); 1974EXPORT_SYMBOL(posix_unblock_lock);