X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ftrace-ust.c;h=8fb685c8d2ab62d4123997fef2be46510e448ebf;hb=07d2ae956551db46c137f85847a6d2972b1b0c9d;hp=0c97d37f1c86883474dc731c7d329638a4d47e8b;hpb=dec56f6cc894de41b312354d360b6a4c09fc199d;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/trace-ust.c b/src/bin/lttng-sessiond/trace-ust.c index 0c97d37f1..8fb685c8d 100644 --- a/src/bin/lttng-sessiond/trace-ust.c +++ b/src/bin/lttng-sessiond/trace-ust.c @@ -384,8 +384,8 @@ struct ltt_ust_metadata *trace_ust_create_metadata(char *path) lum->attr.overwrite = DEFAULT_CHANNEL_OVERWRITE; lum->attr.subbuf_size = default_get_metadata_subbuf_size(); lum->attr.num_subbuf = DEFAULT_METADATA_SUBBUF_NUM; - lum->attr.switch_timer_interval = DEFAULT_UST_CHANNEL_SWITCH_TIMER; - lum->attr.read_timer_interval = DEFAULT_UST_CHANNEL_READ_TIMER; + lum->attr.switch_timer_interval = DEFAULT_METADATA_SWITCH_TIMER; + lum->attr.read_timer_interval = DEFAULT_METADATA_READ_TIMER; lum->attr.output = LTTNG_UST_MMAP; lum->handle = -1; @@ -474,12 +474,14 @@ static void destroy_contexts(struct lttng_ht *ht) assert(ht); + rcu_read_lock(); cds_lfht_for_each_entry(ht->ht, &iter.iter, node, node) { ret = lttng_ht_del(ht, &iter); if (!ret) { call_rcu(&node->head, destroy_context_rcu); } } + rcu_read_unlock(); lttng_ht_destroy(ht); } @@ -520,34 +522,34 @@ static void destroy_events(struct lttng_ht *events) assert(events); + rcu_read_lock(); cds_lfht_for_each_entry(events->ht, &iter.iter, node, node) { ret = lttng_ht_del(events, &iter); assert(!ret); call_rcu(&node->head, destroy_event_rcu); } + rcu_read_unlock(); lttng_ht_destroy(events); } /* * Cleanup ust channel structure. + * + * Should _NOT_ be called with RCU read lock held. */ -void trace_ust_destroy_channel(struct ltt_ust_channel *channel) +static void _trace_ust_destroy_channel(struct ltt_ust_channel *channel) { assert(channel); DBG2("Trace destroy UST channel %s", channel->name); - rcu_read_lock(); - /* Destroying all events of the channel */ destroy_events(channel->events); /* Destroying all context of the channel */ destroy_contexts(channel->ctx); free(channel); - - rcu_read_unlock(); } /* @@ -560,7 +562,12 @@ static void destroy_channel_rcu(struct rcu_head *head) struct ltt_ust_channel *channel = caa_container_of(node, struct ltt_ust_channel, node); - trace_ust_destroy_channel(channel); + _trace_ust_destroy_channel(channel); +} + +void trace_ust_destroy_channel(struct ltt_ust_channel *channel) +{ + call_rcu(&channel->node.head, destroy_channel_rcu); } /* @@ -595,10 +602,9 @@ static void destroy_channels(struct lttng_ht *channels) assert(!ret); call_rcu(&node->head, destroy_channel_rcu); } + rcu_read_unlock(); lttng_ht_destroy(channels); - - rcu_read_unlock(); } /* @@ -613,6 +619,8 @@ static void destroy_domain_global(struct ltt_ust_domain_global *dom) /* * Cleanup ust session structure + * + * Should *NOT* be called with RCU read-side lock held. */ void trace_ust_destroy_session(struct ltt_ust_session *session) { @@ -620,8 +628,6 @@ void trace_ust_destroy_session(struct ltt_ust_session *session) assert(session); - rcu_read_lock(); - DBG2("Trace UST destroy session %u", session->id); /* Cleaning up UST domain */ @@ -639,6 +645,4 @@ void trace_ust_destroy_session(struct ltt_ust_session *session) consumer_destroy_output(session->tmp_consumer); free(session); - - rcu_read_unlock(); }