From 31c0635eada58acef39b637ae455cc8a3ed75af9 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sat, 22 Aug 2015 20:14:44 -0700 Subject: [PATCH] Fix: don't chain RCU free MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We only do a single rcu_barrier() on teardown of sessiond. Therefore, if we chain call_rcu, they may not all be executed before exit. Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/trace-ust.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/bin/lttng-sessiond/trace-ust.c b/src/bin/lttng-sessiond/trace-ust.c index b4dcfe37d..befd5a61b 100644 --- a/src/bin/lttng-sessiond/trace-ust.c +++ b/src/bin/lttng-sessiond/trace-ust.c @@ -951,11 +951,6 @@ static void _trace_ust_destroy_channel(struct ltt_ust_channel *channel) DBG2("Trace destroy UST channel %s", channel->name); - /* Destroying all events of the channel */ - destroy_events(channel->events); - /* Destroying all context of the channel */ - destroy_contexts(channel->ctx); - free(channel); } @@ -974,6 +969,11 @@ static void destroy_channel_rcu(struct rcu_head *head) void trace_ust_destroy_channel(struct ltt_ust_channel *channel) { + /* Destroying all events of the channel */ + destroy_events(channel->events); + /* Destroying all context of the channel */ + destroy_contexts(channel->ctx); + call_rcu(&channel->node.head, destroy_channel_rcu); } @@ -999,18 +999,18 @@ void trace_ust_delete_channel(struct lttng_ht *ht, */ static void destroy_channels(struct lttng_ht *channels) { - int ret; struct lttng_ht_node_str *node; struct lttng_ht_iter iter; assert(channels); rcu_read_lock(); - cds_lfht_for_each_entry(channels->ht, &iter.iter, node, node) { - ret = lttng_ht_del(channels, &iter); - assert(!ret); - call_rcu(&node->head, destroy_channel_rcu); + struct ltt_ust_channel *chan = + caa_container_of(node, struct ltt_ust_channel, node); + + trace_ust_delete_channel(channels, chan); + trace_ust_destroy_channel(chan); } rcu_read_unlock(); -- 2.34.1