diff options
Diffstat (limited to 'fs/lockd/clntlock.c')
-rw-r--r-- | fs/lockd/clntlock.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index 3eaf6e701087..da6354baa0b8 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c | |||
@@ -111,9 +111,10 @@ long nlmclnt_block(struct nlm_rqst *req, long timeout) | |||
111 | /* | 111 | /* |
112 | * The server lockd has called us back to tell us the lock was granted | 112 | * The server lockd has called us back to tell us the lock was granted |
113 | */ | 113 | */ |
114 | u32 | 114 | u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock) |
115 | nlmclnt_grant(struct nlm_lock *lock) | ||
116 | { | 115 | { |
116 | const struct file_lock *fl = &lock->fl; | ||
117 | const struct nfs_fh *fh = &lock->fh; | ||
117 | struct nlm_wait *block; | 118 | struct nlm_wait *block; |
118 | u32 res = nlm_lck_denied; | 119 | u32 res = nlm_lck_denied; |
119 | 120 | ||
@@ -122,14 +123,20 @@ nlmclnt_grant(struct nlm_lock *lock) | |||
122 | * Warning: must not use cookie to match it! | 123 | * Warning: must not use cookie to match it! |
123 | */ | 124 | */ |
124 | list_for_each_entry(block, &nlm_blocked, b_list) { | 125 | list_for_each_entry(block, &nlm_blocked, b_list) { |
125 | if (nlm_compare_locks(block->b_lock, &lock->fl)) { | 126 | struct file_lock *fl_blocked = block->b_lock; |
126 | /* Alright, we found a lock. Set the return status | 127 | |
127 | * and wake up the caller | 128 | if (!nlm_compare_locks(fl_blocked, fl)) |
128 | */ | 129 | continue; |
129 | block->b_status = NLM_LCK_GRANTED; | 130 | if (!nlm_cmp_addr(&block->b_host->h_addr, addr)) |
130 | wake_up(&block->b_wait); | 131 | continue; |
131 | res = nlm_granted; | 132 | if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_dentry->d_inode) ,fh) != 0) |
132 | } | 133 | continue; |
134 | /* Alright, we found a lock. Set the return status | ||
135 | * and wake up the caller | ||
136 | */ | ||
137 | block->b_status = NLM_LCK_GRANTED; | ||
138 | wake_up(&block->b_wait); | ||
139 | res = nlm_granted; | ||
133 | } | 140 | } |
134 | return res; | 141 | return res; |
135 | } | 142 | } |