X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fconsumer.c;h=295e7be5dab1b533143e4ce2fa6a5be16ddb1c5d;hb=dda67f6c1ffa2bd1bb106b21d1ee353a4c1245f8;hp=8d897e5df1e20e20c67ddbc6ed8f99af7e7de2aa;hpb=c8f59ee5fc11492ef472dc5cfd2fd2c4926b1787;p=lttng-tools.git diff --git a/src/common/consumer.c b/src/common/consumer.c index 8d897e5df..295e7be5d 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -56,7 +56,7 @@ int consumer_poll_timeout = -1; * Also updated by the signal handler (consumer_should_exit()). Read by the * polling threads. */ -volatile int consumer_quit = 0; +volatile int consumer_quit; /* * The following two hash tables are visible by all threads which are separated @@ -66,8 +66,8 @@ volatile int consumer_quit = 0; * stream element in this ht should only be updated by the metadata poll thread * for the metadata and the data poll thread for the data. */ -struct lttng_ht *metadata_ht = NULL; -struct lttng_ht *data_ht = NULL; +struct lttng_ht *metadata_ht; +struct lttng_ht *data_ht; /* * Find a stream. The consumer_data.lock must be locked during this @@ -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;