X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fkernel-consumer.c;h=993e7b95cf21da8ff2f151f4412b3079f3746b40;hp=05e447754bb2156a77b6ce3d8dc1555f84973864;hb=b178f53e90c376dd44b020535c32649edef8f80e;hpb=e098433c90550d74288498f8c4474ef4c2daea68 diff --git a/src/bin/lttng-sessiond/kernel-consumer.c b/src/bin/lttng-sessiond/kernel-consumer.c index 05e447754..993e7b95c 100644 --- a/src/bin/lttng-sessiond/kernel-consumer.c +++ b/src/bin/lttng-sessiond/kernel-consumer.c @@ -48,7 +48,7 @@ static char *create_channel_path(struct consumer_output *consumer, ret = snprintf(tmp_path, sizeof(tmp_path), "%s%s%s", consumer->dst.session_root_path, consumer->chunk_path, - consumer->subdir); + consumer->domain_subdir); if (ret < 0) { PERROR("snprintf kernel channel path"); goto error; @@ -57,7 +57,7 @@ static char *create_channel_path(struct consumer_output *consumer, sizeof(tmp_path), ret, consumer->dst.session_root_path, consumer->chunk_path, - consumer->subdir); + consumer->domain_subdir); goto error; } pathname = lttng_strndup(tmp_path, sizeof(tmp_path)); @@ -76,9 +76,10 @@ static char *create_channel_path(struct consumer_output *consumer, } DBG3("Kernel local consumer tracefile path: %s", pathname); } else { + /* Network output. */ ret = snprintf(tmp_path, sizeof(tmp_path), "%s%s", consumer->dst.net.base_dir, - consumer->subdir); + consumer->domain_subdir); if (ret < 0) { PERROR("snprintf kernel metadata path"); goto error; @@ -86,7 +87,7 @@ static char *create_channel_path(struct consumer_output *consumer, ERR("Kernel channel path exceeds the maximal allowed length of of %zu bytes (%i bytes required) with path \"%s%s\"", sizeof(tmp_path), ret, consumer->dst.net.base_dir, - consumer->subdir); + consumer->domain_subdir); goto error; } pathname = lttng_strndup(tmp_path, sizeof(tmp_path)); @@ -107,6 +108,7 @@ error: /* * Sending a single channel to the consumer with command ADD_CHANNEL. */ +static int kernel_consumer_add_channel(struct consumer_socket *sock, struct ltt_kernel_channel *channel, struct ltt_kernel_session *ksession, @@ -117,7 +119,7 @@ int kernel_consumer_add_channel(struct consumer_socket *sock, struct lttcomm_consumer_msg lkm; struct consumer_output *consumer; enum lttng_error_code status; - struct ltt_session *session; + struct ltt_session *session = NULL; struct lttng_channel_extended *channel_attr_extended; /* Safety net */ @@ -191,6 +193,9 @@ int kernel_consumer_add_channel(struct consumer_socket *sock, channel->published_to_notification_thread = true; error: + if (session) { + session_put(session); + } free(pathname); return ret; } @@ -207,7 +212,7 @@ int kernel_consumer_add_metadata(struct consumer_socket *sock, char *pathname; struct lttcomm_consumer_msg lkm; struct consumer_output *consumer; - struct ltt_session *session; + struct ltt_session *session = NULL; rcu_read_lock(); @@ -284,6 +289,9 @@ int kernel_consumer_add_metadata(struct consumer_socket *sock, error: rcu_read_unlock(); free(pathname); + if (session) { + session_put(session); + } return ret; } @@ -379,7 +387,7 @@ int kernel_consumer_send_channel_streams(struct consumer_socket *sock, { int ret = LTTNG_OK; struct ltt_kernel_stream *stream; - struct ltt_session *session; + struct ltt_session *session = NULL; /* Safety net */ assert(channel); @@ -428,6 +436,9 @@ int kernel_consumer_send_channel_streams(struct consumer_socket *sock, error: rcu_read_unlock(); + if (session) { + session_put(session); + } return ret; }