|
@@ -3783,12 +3783,17 @@ void
|
|
|
ring_buffer_read_finish(struct ring_buffer_iter *iter)
|
|
|
{
|
|
|
struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer;
|
|
|
+ unsigned long flags;
|
|
|
|
|
|
/*
|
|
|
* Ring buffer is disabled from recording, here's a good place
|
|
|
- * to check the integrity of the ring buffer.
|
|
|
+ * to check the integrity of the ring buffer.
|
|
|
+ * Must prevent readers from trying to read, as the check
|
|
|
+ * clears the HEAD page and readers require it.
|
|
|
*/
|
|
|
+ raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
|
|
|
rb_check_pages(cpu_buffer);
|
|
|
+ raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
|
|
|
|
|
|
atomic_dec(&cpu_buffer->record_disabled);
|
|
|
atomic_dec(&cpu_buffer->buffer->resize_disabled);
|