Skip to content

Commit

Permalink
ring-buffer: do not reset while in a commit
Browse files Browse the repository at this point in the history
The callers of reset must ensure that no commit can be taking place
at the time of the reset. If it does then we may corrupt the ring buffer.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Sep 4, 2009
1 parent 8e254c1 commit 41b6a95
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 @@ -3373,12 +3373,16 @@ void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu)

spin_lock_irqsave(&cpu_buffer->reader_lock, flags);

if (RB_WARN_ON(cpu_buffer, local_read(&cpu_buffer->committing)))
goto out;

__raw_spin_lock(&cpu_buffer->lock);

rb_reset_cpu(cpu_buffer);

__raw_spin_unlock(&cpu_buffer->lock);

out:
spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);

atomic_dec(&cpu_buffer->record_disabled);
Expand Down

0 comments on commit 41b6a95

Please sign in to comment.