summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/fault_inject.h
diff options
context:
space:
mode:
authorBryan Schumaker2011-11-01 18:35:21 +0100
committerJ. Bruce Fields2011-11-08 03:10:47 +0100
commit65178db42a02c7984f711614546e97e9952d8e01 (patch)
treebab2974af726bb7be58e9cc7045cdf7c63b041b7 /fs/nfsd/fault_inject.h
parentnfsd4: maintain one seqid stream per (lockowner, file) (diff)
downloadkernel-qcow2-linux-65178db42a02c7984f711614546e97e9952d8e01.tar.gz
kernel-qcow2-linux-65178db42a02c7984f711614546e97e9952d8e01.tar.xz
kernel-qcow2-linux-65178db42a02c7984f711614546e97e9952d8e01.zip
NFSD: Added fault injection
Fault injection on the NFS server makes it easier to test the client's state manager and recovery threads. Simulating errors on the server is easier than finding the right conditions that cause them naturally. This patch uses debugfs to add a simple framework for fault injection to the server. This framework is a config option, and can be enabled through CONFIG_NFSD_FAULT_INJECTION. Assuming you have debugfs mounted to /sys/debug, a set of files will be created in /sys/debug/nfsd/. Writing to any of these files will cause the corresponding action and write a log entry to dmesg. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/fault_inject.h')
-rw-r--r--fs/nfsd/fault_inject.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/fs/nfsd/fault_inject.h b/fs/nfsd/fault_inject.h
new file mode 100644
index 000000000000..90bd0570956c
--- /dev/null
+++ b/fs/nfsd/fault_inject.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011 Bryan Schumaker <bjschuma@netapp.com>
+ *
+ * Function definitions for fault injection
+ */
+
+#ifndef LINUX_NFSD_FAULT_INJECT_H
+#define LINUX_NFSD_FAULT_INJECT_H
+
+#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);
+#else /* CONFIG_NFSD_FAULT_INJECTION */
+static inline int nfsd_fault_inject_init(void) { return 0; }
+static inline void nfsd_fault_inject_cleanup(void) {}
+static inline void nfsd_forget_clients(u64 num) {}
+static inline void nfsd_forget_locks(u64 num) {}
+static inline void nfsd_forget_openowners(u64 num) {}
+static inline void nfsd_forget_delegations(u64 num) {}
+static inline void nfsd_recall_delegations(u64 num) {}
+#endif /* CONFIG_NFSD_FAULT_INJECTION */
+
+#endif /* LINUX_NFSD_FAULT_INJECT_H */