From: David Goulet Date: Mon, 22 Oct 2012 21:16:38 +0000 (-0400) Subject: Fix: Mutex and RCU lock nesting in consumer X-Git-Tag: v2.1.0-rc6~29 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6f6eda74c76594068cd8c435c62bf8100a9d734a;p=lttng-tools.git Fix: Mutex and RCU lock nesting in consumer Signed-off-by: David Goulet --- diff --git a/src/common/consumer.c b/src/common/consumer.c index 132e3ec68..295e7be5d 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -1266,11 +1266,11 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap( lttng_consumer_sync_trace_file(stream, orig_offset); end: - pthread_mutex_unlock(&stream->lock); /* Unlock only if ctrl socket used */ if (relayd && stream->metadata_flag) { pthread_mutex_unlock(&relayd->ctrl_sock_mutex); } + pthread_mutex_unlock(&stream->lock); rcu_read_unlock(); return written; @@ -1451,10 +1451,10 @@ splice_error: } end: - pthread_mutex_unlock(&stream->lock); if (relayd && stream->metadata_flag) { pthread_mutex_unlock(&relayd->ctrl_sock_mutex); } + pthread_mutex_unlock(&stream->lock); rcu_read_unlock(); return written; @@ -2462,6 +2462,7 @@ int consumer_data_available(uint64_t id) DBG("Consumer data available command on session id %" PRIu64, id); + rcu_read_lock(); pthread_mutex_lock(&consumer_data.lock); switch (consumer_data.type) { @@ -2477,8 +2478,6 @@ int consumer_data_available(uint64_t id) assert(0); } - rcu_read_lock(); - /* Ease our life a bit */ ht = consumer_data.stream_list_ht;