NFSD: Fault injection improvements
Subsystems (2)
cover NFSD: Fault injection improvements
From: Bryan Schumaker <[email protected]>
These patches apply on top of v2 of my fault injection framework (submitted on may 20). They clean up the injection file creation and add in a method to allow users to specifiy the maximum number of items to forget or recall.
- Bryan
PATCH 1/2 NFSD: Clean up fault injection file creation
From: Bryan Schumaker <[email protected]>
I think it is easier to specify an action and an item (such as "forget" and "clients") once, rather than having to state them multiple times for the same macro.
--- fs/nfsd/fault_inject.c | 39 ++++++++++++++++++++++----------------- 1 files changed, 22 insertions(+), 17 deletions(-)
fs/nfsd/fault_inject.c +22 -17
@@ -12,26 +12,28 @@static void nfsd_forget_everything (void );struct nfsd_fault_inject_op { -char *name; -char *text; +char *action; +char *item; +char *file;int file_data;void (*func)(void ); }; -#define INJECTION_OP (op_name, op_text, op_func) \ -{ \ - .name = op_name, \ - .text = op_text, \ - .func = op_func, \ +#define INJECTION_OP (op_action, op_item, op_func) \ +{ \ + .action = op_action, \ + .item = op_item, \ + .file = op_action"_"op_item, \ + .func = op_func, \ }static struct nfsd_fault_inject_op inject_ops[] = { -INJECTION_OP ("forget_clients" ,"forget all clients" , nfsd_forget_all_clients), -INJECTION_OP ("forget_locks" ,"forget all locks" , nfsd_forget_all_locks), -INJECTION_OP ("forget_open_owners" ,"forget all open owners" , nfsd_forget_all_open_owners), -INJECTION_OP ("forget_delegations" ,"forget all delegations" , nfsd_forget_all_delegations), -INJECTION_OP ("forget_everything" ,"forget everything" , nfsd_forget_everything), -INJECTION_OP ("recall_delegations" ,"recall all delegations" , nfsd_recall_all_delegations), +INJECTION_OP ("forget" ,"clients" , nfsd_forget_all_clients), +INJECTION_OP ("forget" ,"locks" , nfsd_forget_all_locks), +INJECTION_OP ("forget" ,"open_owners" , nfsd_forget_all_open_owners), +INJECTION_OP ("forget" ,"delegations" , nfsd_forget_all_delegations), +INJECTION_OP ("forget" ,"everything" , nfsd_forget_everything), +INJECTION_OP ("recall" ,"delegations" , nfsd_recall_all_delegations), };static long int NUM_INJECT_OPS =sizeof (inject_ops) /sizeof (struct nfsd_fault_inject_op );
@@ -48,10 +50,13 @@ static void nfsd_forget_everything(void)static int nfsd_inject_set (void *data,u64 val) {int i; +struct nfsd_fault_inject_op *op;for (i =0 ; i <NUM_INJECT_OPS ; i++) { -if (&inject_ops[i].file_data == data) { -printk (KERN_INFO "%s %s Server will %s" , __FILE__, __func__, inject_ops[i].text); - inject_ops[i].func (); + op = &inject_ops[i]; +if (&op->file_data == data) { +printk (KERN_INFO "%s %s Server will %s all %s" , __FILE__, + __func__, op->action, op->item); + op->func (); } }return 0 ;
@@ -83,7 +88,7 @@ nfsd_fault_inject_init(void)for (i =0 ; i <NUM_INJECT_OPS ; i++) { op = &inject_ops[i]; -debugfs_create_file (op->name, mode, debug_dir, &op->file_data, &fops_nfsd); +debugfs_create_file (op->file, mode, debug_dir, &op->file_data, &fops_nfsd); }return 0 ; fail:
Signature · 1 line
1.7.6
PATCH 2/2 NFSD: Pass a number to fault injection code
In reply to [email protected]From: Bryan Schumaker <[email protected]>
This number represents the maximum number of items to either forget or recall. Passing 0 means that we should forget or recall all items.
--- fs/nfsd/fault_inject.c | 35 ++++++++++------- fs/nfsd/nfs4state.c | 96 ++++++++++++++++++++++++++++++++++-------------- fs/nfsd/nfsd.h | 20 +++++----- 3 files changed, 98 insertions(+), 53 deletions(-)
fs/nfsd/fault_inject.c +20 -15
@@ -9,14 +9,14 @@#include "state.h" #include "nfsd.h" -static void nfsd_forget_everything (void ); +static void nfsd_forget_everything (u64 );struct nfsd_fault_inject_op {char *action;char *item;char *file;int file_data; -void (*func)(void ); +void (*func)(u64 ); };#define INJECTION_OP (op_action, op_item, op_func) \
@@ -28,23 +28,23 @@ struct nfsd_fault_inject_op { }static struct nfsd_fault_inject_op inject_ops[] = { -INJECTION_OP ("forget" ,"clients" , nfsd_forget_all_clients), -INJECTION_OP ("forget" ,"locks" , nfsd_forget_all_locks), -INJECTION_OP ("forget" ,"open_owners" , nfsd_forget_all_open_owners), -INJECTION_OP ("forget" ,"delegations" , nfsd_forget_all_delegations), +INJECTION_OP ("forget" ,"clients" , nfsd_forget_clients), +INJECTION_OP ("forget" ,"locks" , nfsd_forget_locks), +INJECTION_OP ("forget" ,"open_owners" , nfsd_forget_open_owners), +INJECTION_OP ("forget" ,"delegations" , nfsd_forget_delegations),INJECTION_OP ("forget" ,"everything" , nfsd_forget_everything), -INJECTION_OP ("recall" ,"delegations" , nfsd_recall_all_delegations), +INJECTION_OP ("recall" ,"delegations" , nfsd_recall_delegations), };static long int NUM_INJECT_OPS =sizeof (inject_ops) /sizeof (struct nfsd_fault_inject_op );static struct dentry *debug_dir; -static void nfsd_forget_everything (void ) +static void nfsd_forget_everything (u64 num) { -nfsd_forget_all_clients (); -nfsd_forget_all_locks (); -nfsd_forget_all_open_owners (); -nfsd_forget_all_delegations (); +nfsd_forget_clients (num); +nfsd_forget_locks (num); +nfsd_forget_open_owners (num); +nfsd_forget_delegations (num); }static int nfsd_inject_set (void *data,u64 val)
@@ -54,9 +54,14 @@ static int nfsd_inject_set(void *data, u64 val)for (i =0 ; i <NUM_INJECT_OPS ; i++) { op = &inject_ops[i];if (&op->file_data == data) { -printk (KERN_INFO "%s %s Server will %s all %s" , __FILE__, - __func__, op->action, op->item); - op->func (); +if (val ==0 ) { +printk (KERN_INFO "%s %s Server %sing all %s" , + __FILE__, __func__, op->action, op->item); + }else { +printk (KERN_INFO "%s %s Server %sing at most %llu %s" , + __FILE__, __func__, op->action, val, op->item); + } + op->func (val); } }return 0 ;
fs/nfsd/nfs4state.c +68 -28
189 lines not on this page · raw message
fs/nfsd/nfsd.h +10 -10
@@ -86,11 +86,11 @@ int nfs4_state_start(void);void nfs4_state_shutdown (void );void nfs4_reset_lease (time_t leasetime);int nfs4_reset_recoverydir (char *recdir); -void nfsd_forget_all_clients (void ); -void nfsd_forget_all_locks (void ); -void nfsd_forget_all_open_owners (void ); -void nfsd_forget_all_delegations (void ); -void nfsd_recall_all_delegations (void ); +void nfsd_forget_clients (u64 ); +void nfsd_forget_locks (u64 ); +void nfsd_forget_open_owners (u64 ); +void nfsd_forget_delegations (u64 ); +void nfsd_recall_delegations (u64 );#else static inline int nfs4_state_init (void ) {return 0 ; }static inline void nfsd4_free_slabs (void ) { }
@@ -98,11 +98,11 @@ static inline int nfs4_state_start(void) { return 0; }static inline void nfs4_state_shutdown (void ) { }static inline void nfs4_reset_lease (time_t leasetime) { }static inline int nfs4_reset_recoverydir (char *recdir) {return 0 ; } -static inline void nfsd_forget_all_clients (void ) {}; -static inline void nfsd_forget_all_locks (void ) {}; -static inline void nfsd_forget_all_open_owners (void ) {}; -static inline void nfsd_forget_all_delegations (void ) {}; -static inline void nfsd_recall_all_delegations (void ) {}; +static inline void nfsd_forget_clients (u64 ) {}; +static inline void nfsd_forget_locks (u64 ) {}; +static inline void nfsd_forget_open_owners (u64 ) {}; +static inline void nfsd_forget_delegations (u64 ) {}; +static inline void nfsd_recall_delegations (u64 ) {};#endif /*
Signature · 1 line
1.7.6