aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ring_buffer.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-05-01 20:26:54 -0400
committerSteven Rostedt <rostedt@goodmis.org>2009-05-05 17:22:02 -0400
commit41ede23eded40832c955d98d4b71bc244809abb3 (patch)
tree044d968ac2d5784a80b46ba2ea04e639ac3e501b /kernel/trace/ring_buffer.c
parentafbab76a62b69ea6197e19727d4b8a8aef8deb25 (diff)
ring-buffer: disable writers when resetting buffers
As a precaution, it is best to disable writing to the ring buffers when reseting them. [ Impact: prevent weird things if write happens during reset ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ring_buffer.c')
-rw-r--r--kernel/trace/ring_buffer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 9e42a742a3f9..7876df00695f 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2650,6 +2650,8 @@ void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu)
2650 if (!cpumask_test_cpu(cpu, buffer->cpumask)) 2650 if (!cpumask_test_cpu(cpu, buffer->cpumask))
2651 return; 2651 return;
2652 2652
2653 atomic_inc(&cpu_buffer->record_disabled);
2654
2653 spin_lock_irqsave(&cpu_buffer->reader_lock, flags); 2655 spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
2654 2656
2655 __raw_spin_lock(&cpu_buffer->lock); 2657 __raw_spin_lock(&cpu_buffer->lock);
@@ -2659,6 +2661,8 @@ void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu)
2659 __raw_spin_unlock(&cpu_buffer->lock); 2661 __raw_spin_unlock(&cpu_buffer->lock);
2660 2662
2661 spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); 2663 spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
2664
2665 atomic_dec(&cpu_buffer->record_disabled);
2662} 2666}
2663EXPORT_SYMBOL_GPL(ring_buffer_reset_cpu); 2667EXPORT_SYMBOL_GPL(ring_buffer_reset_cpu);
2664 2668