aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/lockd
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-02-14 16:53:04 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-14 19:09:34 -0500
commit5ac5f9d1ce8492163dbde5d357dc5d03becf7e36 (patch)
tree3ce7f36c074e37dd565b91490582c4a4902f2b18 /include/linux/lockd
parent7c8903f6373f9abecf060bad53ca36bc4ac037f2 (diff)
[PATCH] NLM: Fix the NLM_GRANTED callback checks
If 2 threads attached to the same process are blocking on different locks on different files (maybe even on different servers) but have the same lock arguments (i.e. same offset+length - actually quite common, since most processes try to lock the entire file) then the first GRANTED call that wakes one up will also wake the other. Currently when the NLM_GRANTED callback comes in, lockd walks the list of blocked locks in search of a match to the lock that the NLM server has granted. Although it checks the lock pid, start and end, it fails to check the filehandle and the server address. By checking the filehandle and server IP address, we ensure that this only happens if the locks truly are referencing the same file. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/lockd')
-rw-r--r--include/linux/lockd/lockd.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 920766cea79c..ef21ed296039 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -149,7 +149,7 @@ struct nlm_rqst * nlmclnt_alloc_call(void);
149int nlmclnt_prepare_block(struct nlm_rqst *req, struct nlm_host *host, struct file_lock *fl); 149int nlmclnt_prepare_block(struct nlm_rqst *req, struct nlm_host *host, struct file_lock *fl);
150void nlmclnt_finish_block(struct nlm_rqst *req); 150void nlmclnt_finish_block(struct nlm_rqst *req);
151long nlmclnt_block(struct nlm_rqst *req, long timeout); 151long nlmclnt_block(struct nlm_rqst *req, long timeout);
152u32 nlmclnt_grant(struct nlm_lock *); 152u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *);
153void nlmclnt_recovery(struct nlm_host *, u32); 153void nlmclnt_recovery(struct nlm_host *, u32);
154int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 154int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
155int nlmclnt_setgrantargs(struct nlm_rqst *, struct nlm_lock *); 155int nlmclnt_setgrantargs(struct nlm_rqst *, struct nlm_lock *);
@@ -204,7 +204,7 @@ nlmsvc_file_inode(struct nlm_file *file)
204 * Compare two host addresses (needs modifying for ipv6) 204 * Compare two host addresses (needs modifying for ipv6)
205 */ 205 */
206static __inline__ int 206static __inline__ int
207nlm_cmp_addr(struct sockaddr_in *sin1, struct sockaddr_in *sin2) 207nlm_cmp_addr(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2)
208{ 208{
209 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; 209 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
210} 210}
@@ -214,7 +214,7 @@ nlm_cmp_addr(struct sockaddr_in *sin1, struct sockaddr_in *sin2)
214 * When the second lock is of type F_UNLCK, this acts like a wildcard. 214 * When the second lock is of type F_UNLCK, this acts like a wildcard.
215 */ 215 */
216static __inline__ int 216static __inline__ int
217nlm_compare_locks(struct file_lock *fl1, struct file_lock *fl2) 217nlm_compare_locks(const struct file_lock *fl1, const struct file_lock *fl2)
218{ 218{
219 return fl1->fl_pid == fl2->fl_pid 219 return fl1->fl_pid == fl2->fl_pid
220 && fl1->fl_start == fl2->fl_start 220 && fl1->fl_start == fl2->fl_start