From: Mathieu Desnoyers Date: Wed, 11 Jan 2017 20:49:48 +0000 (-0500) Subject: Fix: sessiond: only send streams to consumer once X-Git-Tag: v2.10.0-rc1~67 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6986ab9b81183b7759e78eb60adaaa8188b8899b;p=lttng-tools.git Fix: sessiond: only send streams to consumer once Session daemon should not send streams to consumer daemon repeatedly when CPU hotplug is performed while doing kernel tracing. This causes the consumer daemon to have multiple file descriptors on the same stream, and thus try to perform operations like reading a sub-buffer and checking for data pending concurrently. This triggers safety-net warnings in the kernel tracer. Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/kernel-consumer.c b/src/bin/lttng-sessiond/kernel-consumer.c index 7582d80f0..2241acbca 100644 --- a/src/bin/lttng-sessiond/kernel-consumer.c +++ b/src/bin/lttng-sessiond/kernel-consumer.c @@ -338,7 +338,7 @@ int kernel_consumer_send_channel_stream(struct consumer_socket *sock, /* Send streams */ cds_list_for_each_entry(stream, &channel->stream_list.head, list) { - if (!stream->fd) { + if (!stream->fd || stream->sent_to_consumer) { continue; } @@ -348,6 +348,7 @@ int kernel_consumer_send_channel_stream(struct consumer_socket *sock, if (ret < 0) { goto error; } + stream->sent_to_consumer = true; } error: diff --git a/src/bin/lttng-sessiond/trace-kernel.h b/src/bin/lttng-sessiond/trace-kernel.h index b9bcbfa77..2092469ad 100644 --- a/src/bin/lttng-sessiond/trace-kernel.h +++ b/src/bin/lttng-sessiond/trace-kernel.h @@ -84,6 +84,7 @@ struct ltt_kernel_stream { int fd; int state; int cpu; + bool sent_to_consumer; /* Format is %s_%d respectively channel name and CPU number. */ char name[DEFAULT_STREAM_NAME_LEN]; uint64_t tracefile_size;