From: David Goulet Date: Wed, 11 Jan 2012 20:21:58 +0000 (-0500) Subject: Add missing rcu read lock and add assert X-Git-Tag: v2.0-pre17~27 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=24d1723f7e614f74b6957ad3f3666a5713664d63 Add missing rcu read lock and add assert Signed-off-by: David Goulet --- diff --git a/lttng-sessiond/channel.c b/lttng-sessiond/channel.c index 7ff974da0..b4dc48d16 100644 --- a/lttng-sessiond/channel.c +++ b/lttng-sessiond/channel.c @@ -266,6 +266,10 @@ int channel_ust_create(struct ltt_ust_session *usess, int domain, return LTTCOMM_OK; error_free_chan: + /* + * No need to remove the channel from the hash table because at this point + * it was not added hence the direct call and no call_rcu(). + */ trace_ust_destroy_channel(uchan); error: free(defattr); diff --git a/lttng-sessiond/trace-ust.c b/lttng-sessiond/trace-ust.c index 0bfcc3bd8..e4a521811 100644 --- a/lttng-sessiond/trace-ust.c +++ b/lttng-sessiond/trace-ust.c @@ -396,9 +396,8 @@ void trace_ust_destroy_channel(struct ltt_ust_channel *channel) cds_lfht_for_each_entry(channel->events->ht, &iter.iter, node, node) { ret = lttng_ht_del(channel->events, &iter); - if (!ret) { - destroy_event(channel->events); - } + assert(!ret); + destroy_event(channel->events); } destroy_context(channel->ctx); @@ -439,6 +438,8 @@ static void destroy_channels(struct lttng_ht *channels) struct lttng_ht_node_str *node; struct lttng_ht_iter iter; + rcu_read_lock(); + cds_lfht_for_each_entry(channels->ht, &iter.iter, node, node) { ret = lttng_ht_del(channels, &iter); if (!ret) { @@ -447,6 +448,8 @@ static void destroy_channels(struct lttng_ht *channels) } lttng_ht_destroy(channels); + + rcu_read_unlock(); } /*