print warning and return -EBUSY on double get_subbuf()
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Jun 2013 23:42:52 +0000 (19:42 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Jun 2013 23:42:52 +0000 (19:42 -0400)
Each get_subbuf() should be paired with a put_subbuf().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/ringbuffer/ring_buffer_frontend.c

index bff920d16a0f6a7a40d3eb2325bb9612a5639273..84341adcd4da6b2b6a06e5e286179d13a90be42b 100644 (file)
@@ -927,6 +927,13 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
        int ret;
        int finalized;
 
+       if (buf->get_subbuf) {
+               /*
+                * Reader is trying to get a subbuffer twice.
+                */
+               CHAN_WARN_ON(chan, 1);
+               return -EBUSY;
+       }
 retry:
        finalized = ACCESS_ONCE(buf->finalized);
        /*
This page took 0.026873 seconds and 4 git commands to generate.