X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=lttng-sessiond%2Fchannel.c;h=3dc04ccb83829ad2077dc2ced938d3ee6c40671b;hp=06b799db1d2132aab97e10ca2ad7e8970be1c10c;hb=58f3ca76ddd0d871fc1b71d816bdbabe1d7adeb1;hpb=3ffdb6251a74cd118b910249bde37e7c355941aa diff --git a/lttng-sessiond/channel.c b/lttng-sessiond/channel.c index 06b799db1..3dc04ccb8 100644 --- a/lttng-sessiond/channel.c +++ b/lttng-sessiond/channel.c @@ -20,11 +20,11 @@ #include #include +#include #include #include #include "channel.h" -#include "hashtable.h" #include "kernel.h" #include "ust-ctl.h" #include "utils.h" @@ -216,7 +216,7 @@ int channel_ust_create(struct ltt_ust_session *usess, int domain, struct lttng_channel *attr) { int ret = LTTCOMM_OK; - struct cds_lfht *chan_ht; + struct lttng_ht *chan_ht; struct ltt_ust_channel *uchan = NULL; struct lttng_channel *defattr = NULL; @@ -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,14 +263,16 @@ int channel_ust_create(struct ltt_ust_session *usess, int domain, goto error_free_chan; } - uchan->enabled = 1; - hashtable_add_unique(chan_ht, &uchan->node); DBG2("Channel %s created successfully", uchan->name); free(defattr); return LTTCOMM_OK; error_free_chan: + /* + * No need to remove the channel from the hash table because at this point + * it was not added hence the direct call and no call_rcu(). + */ trace_ust_destroy_channel(uchan); error: free(defattr);