diff options
Diffstat (limited to 'fs/lockd/clntlock.c')
-rw-r--r-- | fs/lockd/clntlock.c | 54 |
1 files changed, 9 insertions, 45 deletions
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index 8ae79ae4b998..0fc0ee267b04 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c | |||
@@ -155,34 +155,6 @@ u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock) | |||
155 | */ | 155 | */ |
156 | 156 | ||
157 | /* | 157 | /* |
158 | * Mark the locks for reclaiming. | ||
159 | * FIXME: In 2.5 we don't want to iterate through any global file_lock_list. | ||
160 | * Maintain NLM lock reclaiming lists in the nlm_host instead. | ||
161 | */ | ||
162 | static | ||
163 | void nlmclnt_mark_reclaim(struct nlm_host *host) | ||
164 | { | ||
165 | struct file_lock *fl; | ||
166 | struct inode *inode; | ||
167 | struct list_head *tmp; | ||
168 | |||
169 | list_for_each(tmp, &file_lock_list) { | ||
170 | fl = list_entry(tmp, struct file_lock, fl_link); | ||
171 | |||
172 | inode = fl->fl_file->f_dentry->d_inode; | ||
173 | if (inode->i_sb->s_magic != NFS_SUPER_MAGIC) | ||
174 | continue; | ||
175 | if (fl->fl_u.nfs_fl.owner == NULL) | ||
176 | continue; | ||
177 | if (fl->fl_u.nfs_fl.owner->host != host) | ||
178 | continue; | ||
179 | if (!(fl->fl_u.nfs_fl.flags & NFS_LCK_GRANTED)) | ||
180 | continue; | ||
181 | fl->fl_u.nfs_fl.flags |= NFS_LCK_RECLAIM; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | /* | ||
186 | * Someone has sent us an SM_NOTIFY. Ensure we bind to the new port number, | 158 | * Someone has sent us an SM_NOTIFY. Ensure we bind to the new port number, |
187 | * that we mark locks for reclaiming, and that we bump the pseudo NSM state. | 159 | * that we mark locks for reclaiming, and that we bump the pseudo NSM state. |
188 | */ | 160 | */ |
@@ -194,7 +166,12 @@ void nlmclnt_prepare_reclaim(struct nlm_host *host, u32 newstate) | |||
194 | host->h_state++; | 166 | host->h_state++; |
195 | host->h_nextrebind = 0; | 167 | host->h_nextrebind = 0; |
196 | nlm_rebind_host(host); | 168 | nlm_rebind_host(host); |
197 | nlmclnt_mark_reclaim(host); | 169 | |
170 | /* | ||
171 | * Mark the locks for reclaiming. | ||
172 | */ | ||
173 | list_splice_init(&host->h_granted, &host->h_reclaim); | ||
174 | |||
198 | dprintk("NLM: reclaiming locks for host %s", host->h_name); | 175 | dprintk("NLM: reclaiming locks for host %s", host->h_name); |
199 | } | 176 | } |
200 | 177 | ||
@@ -223,9 +200,7 @@ reclaimer(void *ptr) | |||
223 | { | 200 | { |
224 | struct nlm_host *host = (struct nlm_host *) ptr; | 201 | struct nlm_host *host = (struct nlm_host *) ptr; |
225 | struct nlm_wait *block; | 202 | struct nlm_wait *block; |
226 | struct list_head *tmp; | 203 | struct file_lock *fl, *next; |
227 | struct file_lock *fl; | ||
228 | struct inode *inode; | ||
229 | 204 | ||
230 | daemonize("%s-reclaim", host->h_name); | 205 | daemonize("%s-reclaim", host->h_name); |
231 | allow_signal(SIGKILL); | 206 | allow_signal(SIGKILL); |
@@ -237,20 +212,9 @@ reclaimer(void *ptr) | |||
237 | 212 | ||
238 | /* First, reclaim all locks that have been marked. */ | 213 | /* First, reclaim all locks that have been marked. */ |
239 | restart: | 214 | restart: |
240 | list_for_each(tmp, &file_lock_list) { | 215 | list_for_each_entry_safe(fl, next, &host->h_reclaim, fl_u.nfs_fl.list) { |
241 | fl = list_entry(tmp, struct file_lock, fl_link); | 216 | list_del(&fl->fl_u.nfs_fl.list); |
242 | |||
243 | inode = fl->fl_file->f_dentry->d_inode; | ||
244 | if (inode->i_sb->s_magic != NFS_SUPER_MAGIC) | ||
245 | continue; | ||
246 | if (fl->fl_u.nfs_fl.owner == NULL) | ||
247 | continue; | ||
248 | if (fl->fl_u.nfs_fl.owner->host != host) | ||
249 | continue; | ||
250 | if (!(fl->fl_u.nfs_fl.flags & NFS_LCK_RECLAIM)) | ||
251 | continue; | ||
252 | 217 | ||
253 | fl->fl_u.nfs_fl.flags &= ~NFS_LCK_RECLAIM; | ||
254 | nlmclnt_reclaim(host, fl); | 218 | nlmclnt_reclaim(host, fl); |
255 | if (signalled()) | 219 | if (signalled()) |
256 | break; | 220 | break; |