Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347697
b: refs/heads/master
c: 8ce54e0
h: refs/heads/master
i:
  347695: 9f7d58f
v: v3
  • Loading branch information
Bryan Schumaker authored and J. Bruce Fields committed Dec 3, 2012
1 parent b753f14 commit 17fb9b7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 43 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 269de30f10604710dde8d544748b5b6c748b7de8
refs/heads/master: 8ce54e0d82730ece61737c9fd7b61b28ab8c3390
16 changes: 9 additions & 7 deletions trunk/fs/nfsd/fault_inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
};

Expand All @@ -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)
Expand All @@ -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;
}

Expand Down
30 changes: 0 additions & 30 deletions trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -4721,36 +4721,6 @@ 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: */
Expand Down
12 changes: 7 additions & 5 deletions trunk/fs/nfsd/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,13 @@ extern void nfsd4_record_grace_done(struct nfsd_net *nn, 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) {}
Expand Down

0 comments on commit 17fb9b7

Please sign in to comment.