diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2012-11-29 11:40:43 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-12-03 09:59:00 -0500 |
commit | 8ce54e0d82730ece61737c9fd7b61b28ab8c3390 (patch) | |
tree | 7a3cc8c0fea766d99cb93539ed3953b232767fc4 /fs/nfsd/fault_inject.c | |
parent | 269de30f10604710dde8d544748b5b6c748b7de8 (diff) |
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 <bjschuma@netapp.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/fault_inject.c')
-rw-r--r-- | fs/nfsd/fault_inject.c | 16 |
1 files changed, 9 insertions, 7 deletions
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 @@ | |||
13 | 13 | ||
14 | struct nfsd_fault_inject_op { | 14 | struct nfsd_fault_inject_op { |
15 | char *file; | 15 | char *file; |
16 | void (*func)(u64); | 16 | u64 (*forget)(struct nfs4_client *, u64); |
17 | }; | 17 | }; |
18 | 18 | ||
19 | static struct nfsd_fault_inject_op inject_ops[] = { | 19 | static struct nfsd_fault_inject_op inject_ops[] = { |
20 | { | 20 | { |
21 | .file = "forget_clients", | 21 | .file = "forget_clients", |
22 | .func = nfsd_forget_clients, | 22 | .forget = nfsd_forget_client, |
23 | }, | 23 | }, |
24 | { | 24 | { |
25 | .file = "forget_locks", | 25 | .file = "forget_locks", |
26 | .func = nfsd_forget_locks, | 26 | .forget = nfsd_forget_client_locks, |
27 | }, | 27 | }, |
28 | { | 28 | { |
29 | .file = "forget_openowners", | 29 | .file = "forget_openowners", |
30 | .func = nfsd_forget_openowners, | 30 | .forget = nfsd_forget_client_openowners, |
31 | }, | 31 | }, |
32 | { | 32 | { |
33 | .file = "forget_delegations", | 33 | .file = "forget_delegations", |
34 | .func = nfsd_forget_delegations, | 34 | .forget = nfsd_forget_client_delegations, |
35 | }, | 35 | }, |
36 | { | 36 | { |
37 | .file = "recall_delegations", | 37 | .file = "recall_delegations", |
38 | .func = nfsd_recall_delegations, | 38 | .forget = nfsd_recall_client_delegations, |
39 | }, | 39 | }, |
40 | }; | 40 | }; |
41 | 41 | ||
@@ -44,6 +44,7 @@ static struct dentry *debug_dir; | |||
44 | 44 | ||
45 | static int nfsd_inject_set(void *op_ptr, u64 val) | 45 | static int nfsd_inject_set(void *op_ptr, u64 val) |
46 | { | 46 | { |
47 | u64 count = 0; | ||
47 | struct nfsd_fault_inject_op *op = op_ptr; | 48 | struct nfsd_fault_inject_op *op = op_ptr; |
48 | 49 | ||
49 | if (val == 0) | 50 | if (val == 0) |
@@ -52,8 +53,9 @@ static int nfsd_inject_set(void *op_ptr, u64 val) | |||
52 | printk(KERN_INFO "NFSD Fault Injection: %s (n = %llu)", op->file, val); | 53 | printk(KERN_INFO "NFSD Fault Injection: %s (n = %llu)", op->file, val); |
53 | 54 | ||
54 | nfs4_lock_state(); | 55 | nfs4_lock_state(); |
55 | op->func(val); | 56 | count = nfsd_for_n_state(val, op->forget); |
56 | nfs4_unlock_state(); | 57 | nfs4_unlock_state(); |
58 | printk(KERN_INFO "NFSD: %s: found %llu", op->file, count); | ||
57 | return 0; | 59 | return 0; |
58 | } | 60 | } |
59 | 61 | ||