aboutsummaryrefslogtreecommitdiffstats
path: root/fs/locks.c
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@austin.ibm.com>2006-01-24 15:34:47 -0500
committerDave Kleikamp <shaggy@austin.ibm.com>2006-01-24 15:34:47 -0500
commit0a0fc0ddbe732779366ab6b1b879f62195e65967 (patch)
tree7b42490a676cf39ae0691b6859ecf7fd410f229b /fs/locks.c
parent4d5dbd0945d9e0833dd7964a3d6ee33157f7cc7a (diff)
parent3ee68c4af3fd7228c1be63254b9f884614f9ebb2 (diff)
Merge with /home/shaggy/git/linus-clean/
Diffstat (limited to 'fs/locks.c')
-rw-r--r--fs/locks.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/fs/locks.c b/fs/locks.c
index a1e8b2248014..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);
@@ -1105,7 +1104,6 @@ static void time_out_leases(struct inode *inode)
1105 before = &fl->fl_next; 1104 before = &fl->fl_next;
1106 continue; 1105 continue;
1107 } 1106 }
1108 printk(KERN_INFO "lease broken - owner pid = %d\n", fl->fl_pid);
1109 lease_modify(before, fl->fl_type & ~F_INPROGRESS); 1107 lease_modify(before, fl->fl_type & ~F_INPROGRESS);
1110 if (fl == *before) /* lease_modify may have freed fl */ 1108 if (fl == *before) /* lease_modify may have freed fl */
1111 before = &fl->fl_next; 1109 before = &fl->fl_next;
@@ -1430,7 +1428,7 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
1430 lock_kernel(); 1428 lock_kernel();
1431 1429
1432 error = __setlease(filp, arg, &flp); 1430 error = __setlease(filp, arg, &flp);
1433 if (error) 1431 if (error || arg == F_UNLCK)
1434 goto out_unlock; 1432 goto out_unlock;
1435 1433
1436 error = fasync_helper(fd, filp, 1, &flp->fl_fasync); 1434 error = fasync_helper(fd, filp, 1, &flp->fl_fasync);
@@ -1959,22 +1957,18 @@ EXPORT_SYMBOL(posix_block_lock);
1959 * 1957 *
1960 * lockd needs to block waiting for locks. 1958 * lockd needs to block waiting for locks.
1961 */ 1959 */
1962void 1960int
1963posix_unblock_lock(struct file *filp, struct file_lock *waiter) 1961posix_unblock_lock(struct file *filp, struct file_lock *waiter)
1964{ 1962{
1965 /* 1963 int status = 0;
1966 * A remote machine may cancel the lock request after it's been 1964
1967 * granted locally. If that happens, we need to delete the lock.
1968 */
1969 lock_kernel(); 1965 lock_kernel();
1970 if (waiter->fl_next) { 1966 if (waiter->fl_next)
1971 __locks_delete_block(waiter); 1967 __locks_delete_block(waiter);
1972 unlock_kernel(); 1968 else
1973 } else { 1969 status = -ENOENT;
1974 unlock_kernel(); 1970 unlock_kernel();
1975 waiter->fl_type = F_UNLCK; 1971 return status;
1976 posix_lock_file(filp, waiter);
1977 }
1978} 1972}
1979 1973
1980EXPORT_SYMBOL(posix_unblock_lock); 1974EXPORT_SYMBOL(posix_unblock_lock);