From: Mathieu Desnoyers Date: Wed, 1 May 2013 20:46:41 +0000 (-0400) Subject: Cleanup: document RCU read-side lock better X-Git-Tag: v2.2.0-rc2~19 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a500c2570f64a51f0f22d7eb2c0555dd58786521;p=lttng-tools.git Cleanup: document RCU read-side lock better Eventually we will have to move rcu read-side lock within the callees, but let's at least make the current code consistent. Signed-off-by: Mathieu Desnoyers --- diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 03c00a677..8c15c7e13 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -581,6 +581,7 @@ static int flush_channel(uint64_t chan_key) DBG("UST consumer flush channel key %" PRIu64, chan_key); + rcu_read_lock(); channel = consumer_find_channel(chan_key); if (!channel) { ERR("UST consumer flush channel %" PRIu64 " not found", chan_key); @@ -591,20 +592,19 @@ static int flush_channel(uint64_t chan_key) ht = consumer_data.stream_per_chan_id_ht; /* For each stream of the channel id, flush it. */ - rcu_read_lock(); cds_lfht_for_each_entry_duplicate(ht->ht, ht->hash_fct(&channel->key, lttng_ht_seed), ht->match_fct, &channel->key, &iter.iter, stream, node_channel_id.node) { ustctl_flush_buffer(stream->ustream, 1); } - rcu_read_unlock(); - error: + rcu_read_unlock(); return ret; } /* * Close metadata stream wakeup_fd using the given key to retrieve the channel. + * RCU read side lock MUST be acquired before calling this function. * * Return 0 on success else an LTTng error code. */