From: Mathieu Desnoyers Date: Wed, 3 Jul 2013 22:33:37 +0000 (-0400) Subject: Fix: ring buffer: get_subbuf() checks should be performed on "consumed" parameter X-Git-Tag: v2.1.4~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4a4d37928e82f7f202eb2e9427c5fb0359d1b1d9;p=lttng-ust.git Fix: ring buffer: get_subbuf() checks should be performed on "consumed" parameter This triggers lots of false-positive -EAGAIN errors in flight recorder snapshots. Reported-by: Julien Desfossez Signed-off-by: Mathieu Desnoyers --- diff --git a/libringbuffer/ring_buffer_frontend.c b/libringbuffer/ring_buffer_frontend.c index 86640375..2639750f 100644 --- a/libringbuffer/ring_buffer_frontend.c +++ b/libringbuffer/ring_buffer_frontend.c @@ -824,7 +824,7 @@ retry: */ if (((commit_count - chan->backend.subbuf_size) & chan->commit_count_mask) - - (buf_trunc(consumed_cur, chan) + - (buf_trunc(consumed, chan) >> chan->backend.num_subbuf_order) != 0) goto nodata; @@ -833,7 +833,7 @@ retry: * Check that we are not about to read the same subbuffer in * which the writer head is. */ - if (subbuf_trunc(write_offset, chan) - subbuf_trunc(consumed_cur, chan) + if (subbuf_trunc(write_offset, chan) - subbuf_trunc(consumed, chan) == 0) goto nodata;