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:48:57 +0000 (10:48 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 10 Apr 2019 15:06:31 +0000 (11:06 -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 can trigger WARN_ON safety nets in libringbuffer. This safety
net triggers a kernel OOPS report and disables tracing for that channel.

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>
lttng-ring-buffer-client.h

index 63f2b4ca7befa82da0b2fdaf265f1d8f127abe11..8916ab0239a537215a310f05acf1b99c8ef97ff2 100644 (file)
@@ -464,9 +464,10 @@ static int client_stream_id(const struct lib_ring_buffer_config *config,
                        struct lib_ring_buffer *buf,
                        uint64_t *stream_id)
 {
-       struct packet_header *header = client_packet_header(config, buf);
-       *stream_id = header->stream_id;
+       struct channel *chan = buf->backend.chan;
+       struct lttng_channel *lttng_chan = channel_get_private(chan);
 
+       *stream_id = lttng_chan->id;
        return 0;
 }
 
@@ -495,8 +496,7 @@ int client_instance_id(const struct lib_ring_buffer_config *config,
                struct lib_ring_buffer *buf,
                uint64_t *id)
 {
-       struct packet_header *header = client_packet_header(config, buf);
-       *id = header->stream_instance_id;
+       *id = buf->backend.cpu;
 
        return 0;
 }
This page took 0.025473 seconds and 5 git commands to generate.