ring_buffer: reset write when reserve buffer fail
authorLai Jiangshan <laijs@cn.fujitsu.com>
Mon, 12 Jan 2009 03:06:18 +0000 (11:06 +0800)
committerIngo Molnar <mingo@elte.hu>
Wed, 21 Jan 2009 14:21:30 +0000 (15:21 +0100)
commit551b4048b3d4acf15aff9fe4aed89b892c135b02
tree5d8abe8ac236420a36164c24f98c840e89247e02
parent00f57f545afa422db3003b0d0b30a30f8de7ecb2
ring_buffer: reset write when reserve buffer fail

Impact: reset struct buffer_page.write when interrupt storm

if struct buffer_page.write is not reset, any succedent committing
will corrupted ring_buffer:

static inline void
rb_set_commit_to_write(struct ring_buffer_per_cpu *cpu_buffer)
{
......
cpu_buffer->commit_page->commit =
cpu_buffer->commit_page->write;
......
}

when "if (RB_WARN_ON(cpu_buffer, next_page == reader_page))", ring_buffer
is disabled, but some reserved buffers may haven't been committed.
we need reset struct buffer_page.write.

when "if (unlikely(next_page == cpu_buffer->commit_page))", ring_buffer
is still available, we should not corrupt it.

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