From a500c2570f64a51f0f22d7eb2c0555dd58786521 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 1 May 2013 16:46:41 -0400 Subject: [PATCH] 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 --- src/common/ust-consumer/ust-consumer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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. */ -- 2.34.1