From: Jonathan Rajotte Date: Tue, 16 May 2017 20:55:56 +0000 (-0400) Subject: Fix: Send remove channel to notification thread only when necessary X-Git-Tag: v2.10.0-rc2~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6fe2f807dfffcf5b3444118c58ec01cca0e43837;p=lttng-tools.git Fix: Send remove channel to notification thread only when necessary v2: missing "channel" in commit title. Keep the publishing state to the notification thread of the channel object. Issue remove command if the channel was previously published. Fixes #1103 Signed-off-by: Jonathan Rajotte 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 067652b81..0f59aa24f 100644 --- a/src/bin/lttng-sessiond/kernel-consumer.c +++ b/src/bin/lttng-sessiond/kernel-consumer.c @@ -168,6 +168,9 @@ int kernel_consumer_add_channel(struct consumer_socket *sock, ret = -1; goto error; } + + channel->published_to_notification_thread = true; + error: free(pathname); return ret; diff --git a/src/bin/lttng-sessiond/trace-kernel.c b/src/bin/lttng-sessiond/trace-kernel.c index 5769576cd..083add3f3 100644 --- a/src/bin/lttng-sessiond/trace-kernel.c +++ b/src/bin/lttng-sessiond/trace-kernel.c @@ -221,6 +221,7 @@ struct ltt_kernel_channel *trace_kernel_create_channel( lkc->stream_count = 0; lkc->event_count = 0; lkc->enabled = 1; + lkc->published_to_notification_thread = false; /* Init linked list */ CDS_INIT_LIST_HEAD(&lkc->events_list.head); CDS_INIT_LIST_HEAD(&lkc->stream_list.head); @@ -522,7 +523,8 @@ void trace_kernel_destroy_channel(struct ltt_kernel_channel *channel) /* Remove from channel list */ cds_list_del(&channel->list); - if (notification_thread_handle) { + if (notification_thread_handle + && channel->published_to_notification_thread) { status = notification_thread_command_remove_channel( notification_thread_handle, channel->fd, LTTNG_DOMAIN_KERNEL); diff --git a/src/bin/lttng-sessiond/trace-kernel.h b/src/bin/lttng-sessiond/trace-kernel.h index 93870cbfd..5879ca281 100644 --- a/src/bin/lttng-sessiond/trace-kernel.h +++ b/src/bin/lttng-sessiond/trace-kernel.h @@ -64,6 +64,7 @@ struct ltt_kernel_channel { int enabled; unsigned int stream_count; unsigned int event_count; + bool published_to_notification_thread; struct cds_list_head ctx_list; struct lttng_channel *channel; struct ltt_kernel_event_list events_list;