From: Mathieu Desnoyers Date: Thu, 11 May 2017 20:00:55 +0000 (-0400) Subject: Fix: lttng-sessiond: cpu hotplug: send channel to consumer only once X-Git-Tag: v2.9.5~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6c598487f3667228a3457d1f3b0cc8f9e745141c;p=lttng-tools.git Fix: lttng-sessiond: cpu hotplug: send channel to consumer only once On CPU hotplug, we currently send a duplicate of the channel key, which allocates its own object (duplicated) within the consumerd. We want the newly added stream to map to the pre-existing channel key, so don't send the channel duplicate. 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 2241acbca..3649374ef 100644 --- a/src/bin/lttng-sessiond/kernel-consumer.c +++ b/src/bin/lttng-sessiond/kernel-consumer.c @@ -313,7 +313,7 @@ int kernel_consumer_send_channel_stream(struct consumer_socket *sock, struct ltt_kernel_channel *channel, struct ltt_kernel_session *session, unsigned int monitor) { - int ret; + int ret = LTTNG_OK; struct ltt_kernel_stream *stream; /* Safety net */ @@ -331,9 +331,12 @@ int kernel_consumer_send_channel_stream(struct consumer_socket *sock, DBG("Sending streams of channel %s to kernel consumer", channel->channel->name); - ret = kernel_consumer_add_channel(sock, channel, session, monitor); - if (ret < 0) { - goto error; + if (!channel->sent_to_consumer) { + ret = kernel_consumer_add_channel(sock, channel, session, monitor); + if (ret < 0) { + goto error; + } + channel->sent_to_consumer = true; } /* Send streams */ diff --git a/src/bin/lttng-sessiond/trace-kernel.h b/src/bin/lttng-sessiond/trace-kernel.h index 2092469ad..93870cbfd 100644 --- a/src/bin/lttng-sessiond/trace-kernel.h +++ b/src/bin/lttng-sessiond/trace-kernel.h @@ -71,6 +71,7 @@ struct ltt_kernel_channel { struct cds_list_head list; /* Session pointer which has a reference to this object. */ struct ltt_kernel_session *session; + bool sent_to_consumer; }; /* Metadata */