aboutsummaryrefslogtreecommitdiffstats
path: root/fs/locks.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@fieldses.org>2006-01-03 03:55:44 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-06 14:58:53 -0500
commit5996a298da43a03081e9ba2116983d173001c862 (patch)
tree533a3289102051cc3e033eff5730301776e64d31 /fs/locks.c
parentf232142cc21127c829559923eb405d1bcb2e2278 (diff)
NLM: don't unlock on cancel requests
Currently when lockd gets an NLM_CANCEL request, it also does an unlock for the same range. This is incorrect. The Open Group documentation says that "This procedure cancels an *outstanding* blocked lock request." (Emphasis mine.) Also, consider a client that holds a lock on the first byte of a file, and requests a lock on the entire file. If the client cancels that request (perhaps because the requesting process is signalled), the server shouldn't apply perform an unlock on the entire file, since that will also remove the previous lock that the client was already granted. Or consider a lock request that actually *downgraded* an exclusive lock to a shared lock. 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.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 250ef53d25ef..75650d52fe60 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1961,19 +1961,10 @@ EXPORT_SYMBOL(posix_block_lock);
1961void 1961void
1962posix_unblock_lock(struct file *filp, struct file_lock *waiter) 1962posix_unblock_lock(struct file *filp, struct file_lock *waiter)
1963{ 1963{
1964 /*
1965 * A remote machine may cancel the lock request after it's been
1966 * granted locally. If that happens, we need to delete the lock.
1967 */
1968 lock_kernel(); 1964 lock_kernel();
1969 if (waiter->fl_next) { 1965 if (waiter->fl_next)
1970 __locks_delete_block(waiter); 1966 __locks_delete_block(waiter);
1971 unlock_kernel(); 1967 unlock_kernel();
1972 } else {
1973 unlock_kernel();
1974 waiter->fl_type = F_UNLCK;
1975 posix_lock_file(filp, waiter);
1976 }
1977} 1968}
1978 1969
1979EXPORT_SYMBOL(posix_unblock_lock); 1970EXPORT_SYMBOL(posix_unblock_lock);