tracing: Fix race with update_max_tr_single and changing tracers
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Tue, 26 Mar 2013 21:33:00 +0000 (17:33 -0400)
committerSteven Rostedt <rostedt@rostedt.homelinux.com>
Mon, 8 Apr 2013 16:24:22 +0000 (12:24 -0400)
The commit 34600f0e9 "tracing: Fix race with max_tr and changing tracers"
fixed the updating of the main buffers with the race of changing
tracers, but left out the fix to the updating of just a per cpu buffer.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace.c

index 4f1dade56981d6fe5d880e9f6caaf609ab1e9c02..7ba7fc76f9ebc655980b734391613184cbe22da3 100644 (file)
@@ -744,8 +744,11 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu)
                return;
 
        WARN_ON_ONCE(!irqs_disabled());
-       if (WARN_ON_ONCE(!current_trace->allocated_snapshot))
+       if (!current_trace->allocated_snapshot) {
+               /* Only the nop tracer should hit this when disabling */
+               WARN_ON_ONCE(current_trace != &nop_trace);
                return;
+       }
 
        arch_spin_lock(&ftrace_max_lock);