diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2007-02-20 13:57:56 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-20 17:10:14 -0800 |
commit | 1df49008f4ddec9d4f6862b47ea5bdba82078aa4 (patch) | |
tree | af5c77fa8de93a8d48654a4c30c2418e7993a3e7 /lib/fault-inject.c | |
parent | 94412a96c4553255bda7a232a349059dd7543338 (diff) | |
download | linux-1df49008f4ddec9d4f6862b47ea5bdba82078aa4.tar.gz linux-1df49008f4ddec9d4f6862b47ea5bdba82078aa4.tar.bz2 linux-1df49008f4ddec9d4f6862b47ea5bdba82078aa4.zip |
[PATCH] fault injection: split up stacktrace filter Kconfig option
There is no prompt for CONFIG_STACKTRACE, so FAULT_INJECTION cannot be
selected without LOCKDEP enabled. (found by Paolo 'Blaisorblade'
Giarrusso)
In order to fix such broken Kconfig dependency, this patch splits up the
stacktrace filter support for fault injection by new Kconfig option, which
enables to use fault injection on the architecture which doesn't have
general stacktrace support.
Cc: "Paolo 'Blaisorblade' Giarrusso" <blaisorblade@yahoo.it>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/fault-inject.c')
-rw-r--r-- | lib/fault-inject.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/lib/fault-inject.c b/lib/fault-inject.c index b5a90fc056d3..0fabd12c39d7 100644 --- a/lib/fault-inject.c +++ b/lib/fault-inject.c @@ -55,7 +55,7 @@ static bool fail_task(struct fault_attr *attr, struct task_struct *task) #define MAX_STACK_TRACE_DEPTH 32 -#if defined(CONFIG_STACKTRACE) +#ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER static bool fail_stacktrace(struct fault_attr *attr) { @@ -90,17 +90,10 @@ static bool fail_stacktrace(struct fault_attr *attr) static inline bool fail_stacktrace(struct fault_attr *attr) { - static bool firsttime = true; - - if (firsttime) { - printk(KERN_WARNING - "This architecture does not implement save_stack_trace()\n"); - firsttime = false; - } - return false; + return true; } -#endif +#endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ /* * This code is stolen from failmalloc-1.0 @@ -217,6 +210,8 @@ void cleanup_fault_attr_dentries(struct fault_attr *attr) debugfs_remove(attr->dentries.task_filter_file); attr->dentries.task_filter_file = NULL; +#ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER + debugfs_remove(attr->dentries.stacktrace_depth_file); attr->dentries.stacktrace_depth_file = NULL; @@ -232,6 +227,8 @@ void cleanup_fault_attr_dentries(struct fault_attr *attr) debugfs_remove(attr->dentries.reject_end_file); attr->dentries.reject_end_file = NULL; +#endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ + if (attr->dentries.dir) WARN_ON(!simple_empty(attr->dentries.dir)); @@ -269,6 +266,13 @@ int init_fault_attr_dentries(struct fault_attr *attr, const char *name) attr->dentries.task_filter_file = debugfs_create_bool("task-filter", mode, dir, &attr->task_filter); + if (!attr->dentries.probability_file || !attr->dentries.interval_file || + !attr->dentries.times_file || !attr->dentries.space_file || + !attr->dentries.verbose_file || !attr->dentries.task_filter_file) + goto fail; + +#ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER + attr->dentries.stacktrace_depth_file = debugfs_create_ul_MAX_STACK_TRACE_DEPTH( "stacktrace-depth", mode, dir, &attr->stacktrace_depth); @@ -285,18 +289,15 @@ int init_fault_attr_dentries(struct fault_attr *attr, const char *name) attr->dentries.reject_end_file = debugfs_create_ul("reject-end", mode, dir, &attr->reject_end); - - if (!attr->dentries.probability_file || !attr->dentries.interval_file - || !attr->dentries.times_file || !attr->dentries.space_file - || !attr->dentries.verbose_file || !attr->dentries.task_filter_file - || !attr->dentries.stacktrace_depth_file - || !attr->dentries.require_start_file - || !attr->dentries.require_end_file - || !attr->dentries.reject_start_file - || !attr->dentries.reject_end_file - ) + if (!attr->dentries.stacktrace_depth_file || + !attr->dentries.require_start_file || + !attr->dentries.require_end_file || + !attr->dentries.reject_start_file || + !attr->dentries.reject_end_file) goto fail; +#endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ + return 0; fail: cleanup_fault_attr_dentries(attr); |