Skip to content

Commit

Permalink
ring-buffer: disable writers when resetting buffers
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Steven Rostedt authored and rostedt committed May 5, 2009
1 parent afbab76 commit 41ede23
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2650,6 +2650,8 @@ void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu)
if (!cpumask_test_cpu(cpu, buffer->cpumask))
return;

atomic_inc(&cpu_buffer->record_disabled);

spin_lock_irqsave(&cpu_buffer->reader_lock, flags);

__raw_spin_lock(&cpu_buffer->lock);
Expand All @@ -2659,6 +2661,8 @@ void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu)
__raw_spin_unlock(&cpu_buffer->lock);

spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);

atomic_dec(&cpu_buffer->record_disabled);
}
EXPORT_SYMBOL_GPL(ring_buffer_reset_cpu);

Expand Down

0 comments on commit 41ede23

Please sign in to comment.