Fix: Send remove channel to notification thread only when necessary
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 16 May 2017 20:55:56 +0000 (16:55 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 13 Jun 2017 15:43:11 +0000 (11:43 -0400)
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 <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/kernel-consumer.c
src/bin/lttng-sessiond/trace-kernel.c
src/bin/lttng-sessiond/trace-kernel.h

index 067652b811def6d6a65a4604c88b8b1f5cd82873..0f59aa24f51decc781c760ddef1007399851355d 100644 (file)
@@ -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;
index 5769576cd0ea47f9d0f11255cadcbbc2aaf8e3b7..083add3f30f907eee80dc259b0e961f028e50ab3 100644 (file)
@@ -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);
index 93870cbfd6509f98e92b3ff4a4bbb5638c09aaf2..5879ca281be62b29b490d54e86426066934bed83 100644 (file)
@@ -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;
This page took 0.026894 seconds and 4 git commands to generate.