diff options
-rw-r--r-- | kernel/trace/trace.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 1bbfa0446507..3c13e46d7d24 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -3454,7 +3454,7 @@ static int tracing_wait_pipe(struct file *filp) | |||
3454 | return -EINTR; | 3454 | return -EINTR; |
3455 | 3455 | ||
3456 | /* | 3456 | /* |
3457 | * We block until we read something and tracing is enabled. | 3457 | * We block until we read something and tracing is disabled. |
3458 | * We still block if tracing is disabled, but we have never | 3458 | * We still block if tracing is disabled, but we have never |
3459 | * read anything. This allows a user to cat this file, and | 3459 | * read anything. This allows a user to cat this file, and |
3460 | * then enable tracing. But after we have read something, | 3460 | * then enable tracing. But after we have read something, |
@@ -3462,7 +3462,7 @@ static int tracing_wait_pipe(struct file *filp) | |||
3462 | * | 3462 | * |
3463 | * iter->pos will be 0 if we haven't read anything. | 3463 | * iter->pos will be 0 if we haven't read anything. |
3464 | */ | 3464 | */ |
3465 | if (tracing_is_enabled() && iter->pos) | 3465 | if (!tracing_is_enabled() && iter->pos) |
3466 | break; | 3466 | break; |
3467 | } | 3467 | } |
3468 | 3468 | ||
@@ -4817,10 +4817,17 @@ rb_simple_write(struct file *filp, const char __user *ubuf, | |||
4817 | return ret; | 4817 | return ret; |
4818 | 4818 | ||
4819 | if (buffer) { | 4819 | if (buffer) { |
4820 | if (val) | 4820 | mutex_lock(&trace_types_lock); |
4821 | if (val) { | ||
4821 | ring_buffer_record_on(buffer); | 4822 | ring_buffer_record_on(buffer); |
4822 | else | 4823 | if (current_trace->start) |
4824 | current_trace->start(tr); | ||
4825 | } else { | ||
4823 | ring_buffer_record_off(buffer); | 4826 | ring_buffer_record_off(buffer); |
4827 | if (current_trace->stop) | ||
4828 | current_trace->stop(tr); | ||
4829 | } | ||
4830 | mutex_unlock(&trace_types_lock); | ||
4824 | } | 4831 | } |
4825 | 4832 | ||
4826 | (*ppos)++; | 4833 | (*ppos)++; |