@@ -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;
}
@@ -4556,14 +4556,14 @@ nfs4_check_open_reclaim(clientid_t *clid, bool sessions)
#ifdef CONFIG_NFSD_FAULT_INJECTION
-static u64 nfsd_forget_client(struct nfs4_client *clp, u64 max)
+u64 nfsd_forget_client(struct nfs4_client *clp, u64 max)
{
nfsd4_client_record_remove(clp);
expire_client(clp);
return 1;
}
-static u64 nfsd_forget_client_locks(struct nfs4_client *clp, u64 max)
+u64 nfsd_forget_client_locks(struct nfs4_client *clp, u64 max)
{
struct nfs4_stateowner *sop, *next;
u64 count = 0;
@@ -4581,7 +4581,7 @@ static u64 nfsd_forget_client_locks(struct nfs4_client *clp, u64 max)
return count;
}
-static u64 nfsd_forget_client_openowners(struct nfs4_client *clp, u64 max)
+u64 nfsd_forget_client_openowners(struct nfs4_client *clp, u64 max)
{
struct nfs4_openowner *oop, *next;
u64 count = 0;
@@ -4609,7 +4609,7 @@ static u64 nfsd_find_n_delegations(struct nfs4_client *clp, u64 max,
return count;
}
-static u64 nfsd_forget_client_delegations(struct nfs4_client *clp, u64 max)
+u64 nfsd_forget_client_delegations(struct nfs4_client *clp, u64 max)
{
struct nfs4_delegation *dp, *next;
LIST_HEAD(victims);
@@ -4625,7 +4625,7 @@ static u64 nfsd_forget_client_delegations(struct nfs4_client *clp, u64 max)
return count;
}
-static u64 nfsd_recall_client_delegations(struct nfs4_client *clp, u64 max)
+u64 nfsd_recall_client_delegations(struct nfs4_client *clp, u64 max)
{
struct nfs4_delegation *dp, *next;
LIST_HEAD(victims);
@@ -4641,7 +4641,7 @@ static u64 nfsd_recall_client_delegations(struct nfs4_client *clp, u64 max)
return count;
}
-static u64 nfsd_for_n_state(u64 max, u64 (*func)(struct nfs4_client *, u64))
+u64 nfsd_for_n_state(u64 max, u64 (*func)(struct nfs4_client *, u64))
{
struct nfs4_client *clp, *next;
u64 count = 0;
@@ -4655,36 +4655,6 @@ static u64 nfsd_for_n_state(u64 max, u64 (*func)(struct nfs4_client *, u64))
return count;
}
-void nfsd_forget_clients(u64 num)
-{
- u64 count = nfsd_for_n_state(num, nfsd_forget_client);
- printk(KERN_INFO "NFSD: Forgot %llu clients", count);
-}
-
-void nfsd_forget_locks(u64 num)
-{
- u64 count = nfsd_for_n_state(num, nfsd_forget_client_locks);
- printk(KERN_INFO "NFSD: Forgot %llu locks", count);
-}
-
-void nfsd_forget_openowners(u64 num)
-{
- u64 count = nfsd_for_n_state(num, nfsd_forget_client_openowners);
- printk(KERN_INFO "NFSD: Forgot %llu open owners", count);
-}
-
-void nfsd_forget_delegations(u64 num)
-{
- u64 count = nfsd_for_n_state(num, nfsd_forget_client_delegations);
- printk(KERN_INFO "NFSD: Forgot %llu delegations", count);
-}
-
-void nfsd_recall_delegations(u64 num)
-{
- u64 count = nfsd_for_n_state(num, nfsd_recall_client_delegations);
- printk(KERN_INFO "NFSD: Recalled %llu delegations", count);
-}
-
#endif /* CONFIG_NFSD_FAULT_INJECTION */
/* initialization to perform at module load time: */
@@ -486,11 +486,13 @@ extern void nfsd4_record_grace_done(struct net *net, time_t boot_time);
#ifdef CONFIG_NFSD_FAULT_INJECTION
int nfsd_fault_inject_init(void);
void nfsd_fault_inject_cleanup(void);
-void nfsd_forget_clients(u64);
-void nfsd_forget_locks(u64);
-void nfsd_forget_openowners(u64);
-void nfsd_forget_delegations(u64);
-void nfsd_recall_delegations(u64);
+u64 nfsd_for_n_state(u64, u64 (*)(struct nfs4_client *, u64));
+
+u64 nfsd_forget_client(struct nfs4_client *, u64);
+u64 nfsd_forget_client_locks(struct nfs4_client*, u64);
+u64 nfsd_forget_client_openowners(struct nfs4_client *, u64);
+u64 nfsd_forget_client_delegations(struct nfs4_client *, u64);
+u64 nfsd_recall_client_delegations(struct nfs4_client *, u64);
#else /* CONFIG_NFSD_FAULT_INJECTION */
static inline int nfsd_fault_inject_init(void) { return 0; }
static inline void nfsd_fault_inject_cleanup(void) {}