From 8ce54e0d82730ece61737c9fd7b61b28ab8c3390 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Thu, 29 Nov 2012 11:40:43 -0500 Subject: NFSD: Fault injection operations take a per-client forget function The eventual goal is to forget state based on ip address, so it makes sense to call this function in a for-each-client loop until the correct amount of state is forgotten. I also use this patch as an opportunity to rename the forget function from "func()" to "forget()". Signed-off-by: Bryan Schumaker Signed-off-by: J. Bruce Fields --- fs/nfsd/fault_inject.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'fs/nfsd/fault_inject.c') diff --git a/fs/nfsd/fault_inject.c b/fs/nfsd/fault_inject.c index 4b385a14cf96..bf6161adf663 100644 --- a/fs/nfsd/fault_inject.c +++ b/fs/nfsd/fault_inject.c @@ -13,29 +13,29 @@ struct nfsd_fault_inject_op { char *file; - void (*func)(u64); + u64 (*forget)(struct nfs4_client *, u64); }; static struct nfsd_fault_inject_op inject_ops[] = { { .file = "forget_clients", - .func = nfsd_forget_clients, + .forget = nfsd_forget_client, }, { .file = "forget_locks", - .func = nfsd_forget_locks, + .forget = nfsd_forget_client_locks, }, { .file = "forget_openowners", - .func = nfsd_forget_openowners, + .forget = nfsd_forget_client_openowners, }, { .file = "forget_delegations", - .func = nfsd_forget_delegations, + .forget = nfsd_forget_client_delegations, }, { .file = "recall_delegations", - .func = nfsd_recall_delegations, + .forget = nfsd_recall_client_delegations, }, }; @@ -44,6 +44,7 @@ static struct dentry *debug_dir; static int nfsd_inject_set(void *op_ptr, u64 val) { + u64 count = 0; struct nfsd_fault_inject_op *op = op_ptr; if (val == 0) @@ -52,8 +53,9 @@ static int nfsd_inject_set(void *op_ptr, u64 val) printk(KERN_INFO "NFSD Fault Injection: %s (n = %llu)", op->file, val); nfs4_lock_state(); - op->func(val); + count = nfsd_for_n_state(val, op->forget); nfs4_unlock_state(); + printk(KERN_INFO "NFSD: %s: found %llu", op->file, count); return 0; } -- cgit v1.2.3