]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ring-buffer: do not swap if recording is disabled
authorSteven Rostedt <srostedt@redhat.com>
Wed, 21 Jan 2009 20:24:56 +0000 (15:24 -0500)
committerIngo Molnar <mingo@elte.hu>
Thu, 22 Jan 2009 09:27:16 +0000 (10:27 +0100)
If the ring buffer recording has been disabled. Do not let
swapping of ring buffers occur. Simply return -EAGAIN.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/ring_buffer.c
kernel/trace/trace.c

index 0b9de5a3d6997c64301a315c03ae5bfaf88ae040..890020e28a35903bb410bb1808d9ac651499017c 100644 (file)
@@ -2266,9 +2266,24 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
        if (buffer_a->pages != buffer_b->pages)
                return -EINVAL;
 
+       if (ring_buffer_flags != RB_BUFFERS_ON)
+               return -EAGAIN;
+
+       if (atomic_read(&buffer_a->record_disabled))
+               return -EAGAIN;
+
+       if (atomic_read(&buffer_b->record_disabled))
+               return -EAGAIN;
+
        cpu_buffer_a = buffer_a->buffers[cpu];
        cpu_buffer_b = buffer_b->buffers[cpu];
 
+       if (atomic_read(&cpu_buffer_a->record_disabled))
+               return -EAGAIN;
+
+       if (atomic_read(&cpu_buffer_b->record_disabled))
+               return -EAGAIN;
+
        /*
         * We can't do a synchronize_sched here because this
         * function can be called in atomic context.
index 220c264e3111552529c917bd095fb2e62608bc0f..757ae6f7e64839c8d59aea65f15c1593e8c955e3 100644 (file)
@@ -415,7 +415,7 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu)
 
        ftrace_enable_cpu();
 
-       WARN_ON_ONCE(ret);
+       WARN_ON_ONCE(ret && ret != -EAGAIN);
 
        __update_max_tr(tr, tsk, cpu);
        __raw_spin_unlock(&ftrace_max_lock);