diff options
Diffstat (limited to 'fs/lockd/svcsubs.c')
-rw-r--r-- | fs/lockd/svcsubs.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index dbbefbcd6712..1adcf93cb6e6 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/lockd/lockd.h> | 18 | #include <linux/lockd/lockd.h> |
19 | #include <linux/lockd/share.h> | 19 | #include <linux/lockd/share.h> |
20 | #include <linux/lockd/sm_inter.h> | 20 | #include <linux/lockd/sm_inter.h> |
21 | #include <linux/module.h> | ||
22 | #include <linux/mount.h> | ||
21 | 23 | ||
22 | #define NLMDBG_FACILITY NLMDBG_SVCSUBS | 24 | #define NLMDBG_FACILITY NLMDBG_SVCSUBS |
23 | 25 | ||
@@ -230,7 +232,7 @@ nlm_file_inuse(struct nlm_file *file) | |||
230 | * Loop over all files in the file table. | 232 | * Loop over all files in the file table. |
231 | */ | 233 | */ |
232 | static int | 234 | static int |
233 | nlm_traverse_files(struct nlm_host *host, nlm_host_match_fn_t match) | 235 | nlm_traverse_files(void *data, nlm_host_match_fn_t match) |
234 | { | 236 | { |
235 | struct hlist_node *pos, *next; | 237 | struct hlist_node *pos, *next; |
236 | struct nlm_file *file; | 238 | struct nlm_file *file; |
@@ -244,7 +246,7 @@ nlm_traverse_files(struct nlm_host *host, nlm_host_match_fn_t match) | |||
244 | 246 | ||
245 | /* Traverse locks, blocks and shares of this file | 247 | /* Traverse locks, blocks and shares of this file |
246 | * and update file->f_locks count */ | 248 | * and update file->f_locks count */ |
247 | if (nlm_inspect_file(host, file, match)) | 249 | if (nlm_inspect_file(data, file, match)) |
248 | ret = 1; | 250 | ret = 1; |
249 | 251 | ||
250 | mutex_lock(&nlm_file_mutex); | 252 | mutex_lock(&nlm_file_mutex); |
@@ -303,21 +305,27 @@ nlm_release_file(struct nlm_file *file) | |||
303 | * Used by nlmsvc_invalidate_all | 305 | * Used by nlmsvc_invalidate_all |
304 | */ | 306 | */ |
305 | static int | 307 | static int |
306 | nlmsvc_mark_host(struct nlm_host *host, struct nlm_host *dummy) | 308 | nlmsvc_mark_host(void *data, struct nlm_host *dummy) |
307 | { | 309 | { |
310 | struct nlm_host *host = data; | ||
311 | |||
308 | host->h_inuse = 1; | 312 | host->h_inuse = 1; |
309 | return 0; | 313 | return 0; |
310 | } | 314 | } |
311 | 315 | ||
312 | static int | 316 | static int |
313 | nlmsvc_same_host(struct nlm_host *host, struct nlm_host *other) | 317 | nlmsvc_same_host(void *data, struct nlm_host *other) |
314 | { | 318 | { |
319 | struct nlm_host *host = data; | ||
320 | |||
315 | return host == other; | 321 | return host == other; |
316 | } | 322 | } |
317 | 323 | ||
318 | static int | 324 | static int |
319 | nlmsvc_is_client(struct nlm_host *host, struct nlm_host *dummy) | 325 | nlmsvc_is_client(void *data, struct nlm_host *dummy) |
320 | { | 326 | { |
327 | struct nlm_host *host = data; | ||
328 | |||
321 | if (host->h_server) { | 329 | if (host->h_server) { |
322 | /* we are destroying locks even though the client | 330 | /* we are destroying locks even though the client |
323 | * hasn't asked us too, so don't unmonitor the | 331 | * hasn't asked us too, so don't unmonitor the |
@@ -370,3 +378,21 @@ nlmsvc_invalidate_all(void) | |||
370 | */ | 378 | */ |
371 | nlm_traverse_files(NULL, nlmsvc_is_client); | 379 | nlm_traverse_files(NULL, nlmsvc_is_client); |
372 | } | 380 | } |
381 | |||
382 | static int | ||
383 | nlmsvc_match_ip(void *datap, struct nlm_host *host) | ||
384 | { | ||
385 | __be32 *server_addr = datap; | ||
386 | |||
387 | return host->h_saddr.sin_addr.s_addr == *server_addr; | ||
388 | } | ||
389 | |||
390 | int | ||
391 | nlmsvc_unlock_all_by_ip(__be32 server_addr) | ||
392 | { | ||
393 | int ret; | ||
394 | ret = nlm_traverse_files(&server_addr, nlmsvc_match_ip); | ||
395 | return ret ? -EIO : 0; | ||
396 | |||
397 | } | ||
398 | EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_ip); | ||