Fix: don't access packet header for stream_id and stream_instance_id getters stable-2.10-backport
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 10 Apr 2019 14:49:53 +0000 (10:49 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 10 Apr 2019 15:05:45 +0000 (11:05 -0400)
The stream ID and stream instance ID are invariant for a stream, so
there is no point reading them from the packet header currently owned by
the consumer (between get/put subbuf).

Actually, the consumer try to access the stream_id from the live timer
when sending a live beacon without getting the reader subbuffer first,
which was handled by issuing a CHAN_WARN_ON, which disables tracing for
the channel, and prints warning to the consumerd console when running
consumerd with LTTNG_UST_DEBUG=1).

In the case where a ring buffer does not have any data ready, it makes
no sense to try to get a subbuffer for reading anyway, so the approach
was broken.

So return the stream id and stream instance id from the internal
data structures rather than reading it from the ring buffer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-ring-buffer-client.h

index 52c759f78020da2ce00833fc4d50ddd746dbc40e..55209f45236db21b3700f8ddac0179430780eec8 100644 (file)
@@ -556,12 +556,11 @@ static int client_stream_id(struct lttng_ust_lib_ring_buffer *buf,
                struct lttng_ust_shm_handle *handle,
                uint64_t *stream_id)
 {
-       struct packet_header *header;
+       struct channel *chan = shmp(handle, buf->backend.chan);
+       struct lttng_channel *lttng_chan = channel_get_private(chan);
+
+       *stream_id = lttng_chan->id;
 
-       header = client_packet_header(buf, handle);
-       if (!header)
-               return -1;
-       *stream_id = header->stream_id;
        return 0;
 }
 
@@ -592,10 +591,8 @@ static int client_instance_id(struct lttng_ust_lib_ring_buffer *buf,
                struct lttng_ust_shm_handle *handle,
                uint64_t *id)
 {
-       struct packet_header *header;
+       *id = buf->backend.cpu;
 
-       header = client_packet_header(buf, handle);
-       *id = header->stream_instance_id;
        return 0;
 }
 
This page took 0.027056 seconds and 5 git commands to generate.