aboutsummaryrefslogtreecommitdiffstats
path: root/fs/locks.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@fieldses.org>2006-01-03 03:55:46 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-06 14:58:54 -0500
commit64a318ee2af9000df482d7a125c3b3e1f1007404 (patch)
tree7b39e558cccce484635dc847a016bbcb5e83abdb /fs/locks.c
parent2c5acd2e1a73cad59203a1bace21e6b03f2920a9 (diff)
NLM: Further cancel fixes
If the server receives an NLM cancel call and finds no waiting lock to cancel, then chances are the lock has already been applied, and the client just hadn't yet processed the NLM granted callback before it sent the cancel. The Open Group text, for example, perimts a server to return either success (LCK_GRANTED) or failure (LCK_DENIED) in this case. But returning an error seems more helpful; the client may be able to use it to recognize that a race has occurred and to recover from the race. So, modify the relevant functions to return an error in this case. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/locks.c')
-rw-r--r--fs/locks.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 75650d52fe60..fb32d6218e21 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1958,13 +1958,18 @@ EXPORT_SYMBOL(posix_block_lock);
1958 * 1958 *
1959 * lockd needs to block waiting for locks. 1959 * lockd needs to block waiting for locks.
1960 */ 1960 */
1961void 1961int
1962posix_unblock_lock(struct file *filp, struct file_lock *waiter) 1962posix_unblock_lock(struct file *filp, struct file_lock *waiter)
1963{ 1963{
1964 int status = 0;
1965
1964 lock_kernel(); 1966 lock_kernel();
1965 if (waiter->fl_next) 1967 if (waiter->fl_next)
1966 __locks_delete_block(waiter); 1968 __locks_delete_block(waiter);
1969 else
1970 status = -ENOENT;
1967 unlock_kernel(); 1971 unlock_kernel();
1972 return status;
1968} 1973}
1969 1974
1970EXPORT_SYMBOL(posix_unblock_lock); 1975EXPORT_SYMBOL(posix_unblock_lock);