Fix out of order channel insert in hash table
[lttng-tools.git] / lttng-sessiond / channel.c
index b4dc48d161e662f12678e5d8de900e5a7c2761b0..3dc04ccb83829ad2077dc2ced938d3ee6c40671b 100644 (file)
@@ -236,11 +236,16 @@ int channel_ust_create(struct ltt_ust_session *usess, int domain,
                ret = LTTCOMM_FATAL;
                goto error;
        }
+       uchan->enabled = 1;
 
        switch (domain) {
        case LTTNG_DOMAIN_UST:
                DBG2("Channel %s being created in UST global domain", uchan->name);
-               chan_ht = usess->domain_global.channels;
+
+               /* Adding the channel to the channel hash table. */
+               rcu_read_lock();
+               lttng_ht_add_unique_str(usess->domain_global.channels, &uchan->node);
+               rcu_read_unlock();
 
                /* Enable channel for global domain */
                ret = ust_app_create_channel_glb(usess, uchan);
@@ -258,8 +263,6 @@ int channel_ust_create(struct ltt_ust_session *usess, int domain,
                goto error_free_chan;
        }
 
-       uchan->enabled = 1;
-       lttng_ht_add_unique_str(chan_ht, &uchan->node);
        DBG2("Channel %s created successfully", uchan->name);
 
        free(defattr);
This page took 0.022773 seconds and 4 git commands to generate.