X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcontext.c;h=6aacbad0ea1c96ad3375739ca908f765f1ba4370;hp=c1b7410da00020dc541313326892d850e6810b28;hb=f263b7fd113e51d0737554e8232b8669e142a260;hpb=0525e9ae15d215943d8187e7f190d5a45e723085 diff --git a/src/bin/lttng-sessiond/context.c b/src/bin/lttng-sessiond/context.c index c1b7410da..6aacbad0e 100644 --- a/src/bin/lttng-sessiond/context.c +++ b/src/bin/lttng-sessiond/context.c @@ -132,6 +132,7 @@ static int add_uctx_to_channel(struct ltt_ust_session *usess, int domain, /* Add ltt UST context node to ltt UST channel */ lttng_ht_add_unique_ulong(uchan->ctx, &uctx->node); rcu_read_unlock(); + cds_list_add_tail(&uctx->list, &uchan->ctx_list); DBG("Context UST %d added to channel %s", uctx->ctx.ctx, uchan->name); @@ -201,7 +202,7 @@ int context_kernel_add(struct ltt_kernel_session *ksession, LTTNG_SYMBOL_NAME_LEN); kctx.u.perf_counter.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0'; - if (strlen(channel_name) == 0) { + if (*channel_name == '\0') { ret = add_kctx_all_channels(ksession, &kctx); if (ret != LTTNG_OK) { goto error; @@ -241,6 +242,8 @@ int context_ust_add(struct ltt_ust_session *usess, int domain, assert(ctx); assert(channel_name); + rcu_read_lock(); + /* * Define which channel's hashtable to use from the domain or quit if * unknown domain. @@ -260,7 +263,7 @@ int context_ust_add(struct ltt_ust_session *usess, int domain, } /* Get UST channel if defined */ - if (strlen(channel_name) != 0) { + if (channel_name[0] != '\0') { uchan = trace_ust_find_channel_by_name(chan_ht, channel_name); if (uchan == NULL) { ret = LTTNG_ERR_UST_CHAN_NOT_FOUND; @@ -303,5 +306,6 @@ int context_ust_add(struct ltt_ust_session *usess, int domain, } error: + rcu_read_unlock(); return ret; }