aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svcsubs.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2008-07-25 10:40:14 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-07-25 10:40:14 -0400
commitff877ea80efa2015b6263766f78ee42c2a1b32f9 (patch)
tree85205005c611ab774702148558321c6fb92f1ccd /fs/lockd/svcsubs.c
parent30821fee4f0cb3e6d241d9f7ddc37742212e3eb7 (diff)
parentd37e6bf68fc1eb34a4ad21d9ae8890ed37ea80e7 (diff)
Merge branch 'linux-next' of git://git.infradead.org/~dedekind/ubi-2.6
Diffstat (limited to 'fs/lockd/svcsubs.c')
-rw-r--r--fs/lockd/svcsubs.c32
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 */
379void 382void
380nlmsvc_invalidate_all(void) 383nlmsvc_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 */
399int 408int
400nlmsvc_unlock_all_by_sb(struct super_block *sb) 409nlmsvc_unlock_all_by_sb(struct super_block *sb)
401{ 410{
@@ -409,17 +418,22 @@ EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_sb);
409static int 418static int
410nlmsvc_match_ip(void *datap, struct nlm_host *host) 419nlmsvc_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 */
417int 431int
418nlmsvc_unlock_all_by_ip(__be32 server_addr) 432nlmsvc_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}
425EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_ip); 439EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_ip);