aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfsctl.c
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2011-11-01 13:35:21 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-11-07 21:10:47 -0500
commit65178db42a02c7984f711614546e97e9952d8e01 (patch)
treebab2974af726bb7be58e9cc7045cdf7c63b041b7 /fs/nfsd/nfsctl.c
parent64a284d07c7d84299a90826950079a8ef11e8204 (diff)
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/nfsctl.c')
-rw-r--r--fs/nfsd/nfsctl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index c45a2ea4a090..b2e8093ebc21 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -18,6 +18,7 @@
18#include "idmap.h" 18#include "idmap.h"
19#include "nfsd.h" 19#include "nfsd.h"
20#include "cache.h" 20#include "cache.h"
21#include "fault_inject.h"
21 22
22/* 23/*
23 * We have a single directory with several nodes in it. 24 * We have a single directory with several nodes in it.
@@ -1131,6 +1132,9 @@ static int __init init_nfsd(void)
1131 retval = nfs4_state_init(); /* nfs4 locking state */ 1132 retval = nfs4_state_init(); /* nfs4 locking state */
1132 if (retval) 1133 if (retval)
1133 return retval; 1134 return retval;
1135 retval = nfsd_fault_inject_init(); /* nfsd fault injection controls */
1136 if (retval)
1137 goto out_free_slabs;
1134 nfsd_stat_init(); /* Statistics */ 1138 nfsd_stat_init(); /* Statistics */
1135 retval = nfsd_reply_cache_init(); 1139 retval = nfsd_reply_cache_init();
1136 if (retval) 1140 if (retval)
@@ -1161,6 +1165,8 @@ out_free_cache:
1161 nfsd_reply_cache_shutdown(); 1165 nfsd_reply_cache_shutdown();
1162out_free_stat: 1166out_free_stat:
1163 nfsd_stat_shutdown(); 1167 nfsd_stat_shutdown();
1168 nfsd_fault_inject_cleanup();
1169out_free_slabs:
1164 nfsd4_free_slabs(); 1170 nfsd4_free_slabs();
1165 return retval; 1171 return retval;
1166} 1172}
@@ -1175,6 +1181,7 @@ static void __exit exit_nfsd(void)
1175 nfsd_lockd_shutdown(); 1181 nfsd_lockd_shutdown();
1176 nfsd_idmap_shutdown(); 1182 nfsd_idmap_shutdown();
1177 nfsd4_free_slabs(); 1183 nfsd4_free_slabs();
1184 nfsd_fault_inject_cleanup();
1178 unregister_filesystem(&nfsd_fs_type); 1185 unregister_filesystem(&nfsd_fs_type);
1179} 1186}
1180 1187