aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2012-11-29 11:40:44 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-12-03 09:59:01 -0500
commit184c18471f7d0963ad5752692c4b441a546d88f1 (patch)
tree92dc8d2d5d7104888055741b6c2c6fca67795b05 /fs/nfsd/nfs4state.c
parent8ce54e0d82730ece61737c9fd7b61b28ab8c3390 (diff)
NFSD: Reading a fault injection file prints a state count
I also log basic information that I can figure out about the type of state (such as number of locks for each client IP address). This can be useful for checking that state was actually dropped and later for checking if the client was able to recover. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index ab45cdd7b3da..9fb8e52580f3 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4611,6 +4611,22 @@ u64 nfsd_forget_client(struct nfs4_client *clp, u64 max)
4611 return 1; 4611 return 1;
4612} 4612}
4613 4613
4614u64 nfsd_print_client(struct nfs4_client *clp, u64 num)
4615{
4616 char buf[INET6_ADDRSTRLEN];
4617 rpc_ntop((struct sockaddr *)&clp->cl_addr, buf, 129);
4618 printk(KERN_INFO "NFS Client: %s\n", buf);
4619 return 1;
4620}
4621
4622static void nfsd_print_count(struct nfs4_client *clp, unsigned int count,
4623 const char *type)
4624{
4625 char buf[INET6_ADDRSTRLEN];
4626 rpc_ntop((struct sockaddr *)&clp->cl_addr, buf, 129);
4627 printk(KERN_INFO "NFS Client: %s has %u %s\n", buf, count, type);
4628}
4629
4614static u64 nfsd_foreach_client_lock(struct nfs4_client *clp, u64 max, void (*func)(struct nfs4_lockowner *)) 4630static u64 nfsd_foreach_client_lock(struct nfs4_client *clp, u64 max, void (*func)(struct nfs4_lockowner *))
4615{ 4631{
4616 struct nfs4_openowner *oop; 4632 struct nfs4_openowner *oop;
@@ -4637,6 +4653,13 @@ u64 nfsd_forget_client_locks(struct nfs4_client *clp, u64 max)
4637 return nfsd_foreach_client_lock(clp, max, release_lockowner); 4653 return nfsd_foreach_client_lock(clp, max, release_lockowner);
4638} 4654}
4639 4655
4656u64 nfsd_print_client_locks(struct nfs4_client *clp, u64 max)
4657{
4658 u64 count = nfsd_foreach_client_lock(clp, max, NULL);
4659 nfsd_print_count(clp, count, "locked files");
4660 return count;
4661}
4662
4640static u64 nfsd_foreach_client_open(struct nfs4_client *clp, u64 max, void (*func)(struct nfs4_openowner *)) 4663static u64 nfsd_foreach_client_open(struct nfs4_client *clp, u64 max, void (*func)(struct nfs4_openowner *))
4641{ 4664{
4642 struct nfs4_openowner *oop, *next; 4665 struct nfs4_openowner *oop, *next;
@@ -4657,6 +4680,13 @@ u64 nfsd_forget_client_openowners(struct nfs4_client *clp, u64 max)
4657 return nfsd_foreach_client_open(clp, max, release_openowner); 4680 return nfsd_foreach_client_open(clp, max, release_openowner);
4658} 4681}
4659 4682
4683u64 nfsd_print_client_openowners(struct nfs4_client *clp, u64 max)
4684{
4685 u64 count = nfsd_foreach_client_open(clp, max, NULL);
4686 nfsd_print_count(clp, count, "open files");
4687 return count;
4688}
4689
4660static u64 nfsd_find_all_delegations(struct nfs4_client *clp, u64 max, 4690static u64 nfsd_find_all_delegations(struct nfs4_client *clp, u64 max,
4661 struct list_head *victims) 4691 struct list_head *victims)
4662{ 4692{
@@ -4703,6 +4733,18 @@ u64 nfsd_recall_client_delegations(struct nfs4_client *clp, u64 max)
4703 return count; 4733 return count;
4704} 4734}
4705 4735
4736u64 nfsd_print_client_delegations(struct nfs4_client *clp, u64 max)
4737{
4738 u64 count = 0;
4739
4740 spin_lock(&recall_lock);
4741 count = nfsd_find_all_delegations(clp, max, NULL);
4742 spin_unlock(&recall_lock);
4743
4744 nfsd_print_count(clp, count, "delegations");
4745 return count;
4746}
4747
4706u64 nfsd_for_n_state(u64 max, u64 (*func)(struct nfs4_client *, u64)) 4748u64 nfsd_for_n_state(u64 max, u64 (*func)(struct nfs4_client *, u64))
4707{ 4749{
4708 struct nfs4_client *clp, *next; 4750 struct nfs4_client *clp, *next;