diff options
author | Steven Rostedt <srostedt@redhat.com> | 2012-04-16 15:41:28 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2012-04-16 15:41:28 -0400 |
commit | 348f0fc238efb441a28e7644c51f9fd3001b228a (patch) | |
tree | 780fa93c72777045a986f0ce648efc2bf8e35999 /kernel/trace/trace.c | |
parent | 6e48b550d1f5f1919e6500547ae14a73fbf66c7b (diff) |
tracing: Fix regression with tracing_on
The change to make tracing_on affect only the ftrace ring buffer, caused
a bug where it wont affect any ring buffer. The problem was that the buffer
of the trace_array was passed to the write function and not the trace array
itself.
The trace_array can change the buffer when running a latency tracer. If this
happens, then the buffer being disabled may not be the buffer currently used
by ftrace. This will cause the tracing_on file to become useless.
The simple fix is to pass the trace_array to the write function instead of
the buffer. Then the actual buffer may be changed.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index ed7b5d1e12f4..2a22255c1010 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -4629,7 +4629,8 @@ static ssize_t | |||
4629 | rb_simple_read(struct file *filp, char __user *ubuf, | 4629 | rb_simple_read(struct file *filp, char __user *ubuf, |
4630 | size_t cnt, loff_t *ppos) | 4630 | size_t cnt, loff_t *ppos) |
4631 | { | 4631 | { |
4632 | struct ring_buffer *buffer = filp->private_data; | 4632 | struct trace_array *tr = filp->private_data; |
4633 | struct ring_buffer *buffer = tr->buffer; | ||
4633 | char buf[64]; | 4634 | char buf[64]; |
4634 | int r; | 4635 | int r; |
4635 | 4636 | ||
@@ -4647,7 +4648,8 @@ static ssize_t | |||
4647 | rb_simple_write(struct file *filp, const char __user *ubuf, | 4648 | rb_simple_write(struct file *filp, const char __user *ubuf, |
4648 | size_t cnt, loff_t *ppos) | 4649 | size_t cnt, loff_t *ppos) |
4649 | { | 4650 | { |
4650 | struct ring_buffer *buffer = filp->private_data; | 4651 | struct trace_array *tr = filp->private_data; |
4652 | struct ring_buffer *buffer = tr->buffer; | ||
4651 | unsigned long val; | 4653 | unsigned long val; |
4652 | int ret; | 4654 | int ret; |
4653 | 4655 | ||
@@ -4734,7 +4736,7 @@ static __init int tracer_init_debugfs(void) | |||
4734 | &trace_clock_fops); | 4736 | &trace_clock_fops); |
4735 | 4737 | ||
4736 | trace_create_file("tracing_on", 0644, d_tracer, | 4738 | trace_create_file("tracing_on", 0644, d_tracer, |
4737 | global_trace.buffer, &rb_simple_fops); | 4739 | &global_trace, &rb_simple_fops); |
4738 | 4740 | ||
4739 | #ifdef CONFIG_DYNAMIC_FTRACE | 4741 | #ifdef CONFIG_DYNAMIC_FTRACE |
4740 | trace_create_file("dyn_ftrace_total_info", 0444, d_tracer, | 4742 | trace_create_file("dyn_ftrace_total_info", 0444, d_tracer, |