aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-06-26 04:55:51 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-26 14:48:39 -0400
commita32c7765e2796395aec49f699bd25c407155e9c5 (patch)
tree6d46f223a177ada92c6f47c36ba2e51cd6041037 /kernel
parent0296e4254f3318e0dcad9706fa1daf8e5addc1e9 (diff)
tracing: Fix stack tracer sysctl handling
This made my machine completely frozen: # echo 1 > /proc/sys/kernel/stack_tracer_enabled # echo 2 > /proc/sys/kernel/stack_tracer_enabled The cause is register_ftrace_function() was called twice. Also fix ftrace_enabled sysctl, though seems nothing bad happened as I tested it. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <4A448D17.9010305@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/ftrace.c4
-rw-r--r--kernel/trace/trace_stack.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index f3716bf04df6..bce9e01a29c8 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3160,10 +3160,10 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
3160 3160
3161 ret = proc_dointvec(table, write, file, buffer, lenp, ppos); 3161 ret = proc_dointvec(table, write, file, buffer, lenp, ppos);
3162 3162
3163 if (ret || !write || (last_ftrace_enabled == ftrace_enabled)) 3163 if (ret || !write || (last_ftrace_enabled == !!ftrace_enabled))
3164 goto out; 3164 goto out;
3165 3165
3166 last_ftrace_enabled = ftrace_enabled; 3166 last_ftrace_enabled = !!ftrace_enabled;
3167 3167
3168 if (ftrace_enabled) { 3168 if (ftrace_enabled) {
3169 3169
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 2d7aebd71dbd..e644af910124 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -326,10 +326,10 @@ stack_trace_sysctl(struct ctl_table *table, int write,
326 ret = proc_dointvec(table, write, file, buffer, lenp, ppos); 326 ret = proc_dointvec(table, write, file, buffer, lenp, ppos);
327 327
328 if (ret || !write || 328 if (ret || !write ||
329 (last_stack_tracer_enabled == stack_tracer_enabled)) 329 (last_stack_tracer_enabled == !!stack_tracer_enabled))
330 goto out; 330 goto out;
331 331
332 last_stack_tracer_enabled = stack_tracer_enabled; 332 last_stack_tracer_enabled = !!stack_tracer_enabled;
333 333
334 if (stack_tracer_enabled) 334 if (stack_tracer_enabled)
335 register_ftrace_function(&trace_ops); 335 register_ftrace_function(&trace_ops);