diff options
Diffstat (limited to 'fs/lockd/svcsubs.c')
-rw-r--r-- | fs/lockd/svcsubs.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index d1c48b539df8..198b4e55b373 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c | |||
@@ -373,13 +373,16 @@ nlmsvc_free_host_resources(struct nlm_host *host) | |||
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | /* | 376 | /** |
377 | * Remove all locks held for clients | 377 | * nlmsvc_invalidate_all - remove all locks held for clients |
378 | * | ||
379 | * Release all locks held by NFS clients. | ||
380 | * | ||
378 | */ | 381 | */ |
379 | void | 382 | void |
380 | nlmsvc_invalidate_all(void) | 383 | nlmsvc_invalidate_all(void) |
381 | { | 384 | { |
382 | /* Release all locks held by NFS clients. | 385 | /* |
383 | * Previously, the code would call | 386 | * Previously, the code would call |
384 | * nlmsvc_free_host_resources for each client in | 387 | * nlmsvc_free_host_resources for each client in |
385 | * turn, which is about as inefficient as it gets. | 388 | * turn, which is about as inefficient as it gets. |
@@ -396,6 +399,12 @@ nlmsvc_match_sb(void *datap, struct nlm_file *file) | |||
396 | return sb == file->f_file->f_path.mnt->mnt_sb; | 399 | return sb == file->f_file->f_path.mnt->mnt_sb; |
397 | } | 400 | } |
398 | 401 | ||
402 | /** | ||
403 | * nlmsvc_unlock_all_by_sb - release locks held on this file system | ||
404 | * @sb: super block | ||
405 | * | ||
406 | * Release all locks held by clients accessing this file system. | ||
407 | */ | ||
399 | int | 408 | int |
400 | nlmsvc_unlock_all_by_sb(struct super_block *sb) | 409 | nlmsvc_unlock_all_by_sb(struct super_block *sb) |
401 | { | 410 | { |
@@ -409,17 +418,22 @@ EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_sb); | |||
409 | static int | 418 | static int |
410 | nlmsvc_match_ip(void *datap, struct nlm_host *host) | 419 | nlmsvc_match_ip(void *datap, struct nlm_host *host) |
411 | { | 420 | { |
412 | __be32 *server_addr = datap; | 421 | return nlm_cmp_addr(&host->h_saddr, datap); |
413 | |||
414 | return host->h_saddr.sin_addr.s_addr == *server_addr; | ||
415 | } | 422 | } |
416 | 423 | ||
424 | /** | ||
425 | * nlmsvc_unlock_all_by_ip - release local locks by IP address | ||
426 | * @server_addr: server's IP address as seen by clients | ||
427 | * | ||
428 | * Release all locks held by clients accessing this host | ||
429 | * via the passed in IP address. | ||
430 | */ | ||
417 | int | 431 | int |
418 | nlmsvc_unlock_all_by_ip(__be32 server_addr) | 432 | nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr) |
419 | { | 433 | { |
420 | int ret; | 434 | int ret; |
421 | ret = nlm_traverse_files(&server_addr, nlmsvc_match_ip, NULL); | ||
422 | return ret ? -EIO : 0; | ||
423 | 435 | ||
436 | ret = nlm_traverse_files(server_addr, nlmsvc_match_ip, NULL); | ||
437 | return ret ? -EIO : 0; | ||
424 | } | 438 | } |
425 | EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_ip); | 439 | EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_ip); |