Fix: add missing rcu lock for UST lookup
[lttng-tools.git] / src / bin / lttng-sessiond / trace-ust.c
index 1fda555ea0e987bdcc11565b43ffea84b1d85765..801e8907758a7b8066e7dd9e85268c21a4adc36e 100644 (file)
@@ -116,7 +116,8 @@ no_match:
 }
 
 /*
- * Find the channel in the hashtable.
+ * Find the channel in the hashtable and return channel pointer. RCU read side
+ * lock MUST be acquired before calling this.
  */
 struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
                char *name)
@@ -124,14 +125,11 @@ struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
 
-       rcu_read_lock();
        lttng_ht_lookup(ht, (void *)name, &iter);
        node = lttng_ht_iter_get_node_str(&iter);
        if (node == NULL) {
-               rcu_read_unlock();
                goto error;
        }
-       rcu_read_unlock();
 
        DBG2("Trace UST channel %s found by name", name);
 
@@ -143,7 +141,8 @@ error:
 }
 
 /*
- * Find the event in the hashtable.
+ * Find the event in the hashtable and return event pointer. RCU read side lock
+ * MUST be acquired before calling this.
  */
 struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
                char *name, struct lttng_filter_bytecode *filter, int loglevel)
@@ -183,7 +182,6 @@ error:
 struct ltt_ust_session *trace_ust_create_session(char *path,
                unsigned int session_id, struct lttng_domain *domain)
 {
-       int ret;
        struct ltt_ust_session *lus;
 
        /* Allocate a new ltt ust session */
@@ -219,6 +217,8 @@ struct ltt_ust_session *trace_ust_create_session(char *path,
 
        /* Use the default consumer output which is the tracing session path. */
        if (path && strlen(path) > 0) {
+               int ret;
+
                ret = snprintf(lus->consumer->dst.trace_path, PATH_MAX,
                                "%s" DEFAULT_UST_TRACE_DIR, path);
                if (ret < 0) {
This page took 0.02533 seconds and 4 git commands to generate.