Fix: free ust channel object after grace period in consumer
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 27 Apr 2016 20:28:02 +0000 (16:28 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 14 May 2016 19:56:11 +0000 (15:56 -0400)
[ Backport from master branch
commit b83e03c499 "Fix: free metadata cache after grace period in consumer" ]

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/consumer.c
src/common/ust-consumer/ust-consumer.c
src/common/ust-consumer/ust-consumer.h

index 2dd31ffd6c432af12018b00629c9482fbfbc93bd..9a3bf86e797d6213b40b0ed1811f116417f89685 100644 (file)
@@ -285,6 +285,17 @@ static void free_channel_rcu(struct rcu_head *head)
        struct lttng_consumer_channel *channel =
                caa_container_of(node, struct lttng_consumer_channel, node);
 
+       switch (consumer_data.type) {
+       case LTTNG_CONSUMER_KERNEL:
+               break;
+       case LTTNG_CONSUMER32_UST:
+       case LTTNG_CONSUMER64_UST:
+               lttng_ustconsumer_free_channel(channel);
+               break;
+       default:
+               ERR("Unknown consumer_data type");
+               abort();
+       }
        free(channel);
 }
 
index 28b7f10a6f7b655a6bf62f7b8594bc21be06515f..152455ca64fa7e938834c01d697bb3b97e6198a8 100644 (file)
@@ -79,6 +79,7 @@ static void destroy_channel(struct lttng_consumer_channel *channel)
         */
        if (channel->uchan) {
                lttng_ustconsumer_del_channel(channel);
+               lttng_ustconsumer_free_channel(channel);
        }
        free(channel);
 }
@@ -1687,6 +1688,13 @@ void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
        if (chan->switch_timer_enabled == 1) {
                consumer_timer_switch_stop(chan);
        }
+}
+
+void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
+{
+       assert(chan);
+       assert(chan->uchan);
+
        consumer_metadata_cache_destroy(chan);
        ustctl_destroy_channel(chan->uchan);
 }
index 4357380a60965855d36fe199d9cf7c68eb446e5b..08f1fa8a33bef09b81632fcfe4fed5df6325da4e 100644 (file)
@@ -38,6 +38,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
 extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan);
 extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan);
+extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan);
 extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream);
 extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream);
 
@@ -119,6 +120,11 @@ void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
 {
 }
 
+static inline
+void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
+{
+}
+
 static inline
 int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream)
 {
This page took 0.039394 seconds and 4 git commands to generate.