From: Jérémie Galarneau Date: Tue, 19 Feb 2019 21:48:23 +0000 (-0500) Subject: relayd: create an implicit trace chunk on session creation X-Git-Tag: v2.12.0-rc1~541 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=639ddf685b134bb075b92819f647f9f3c462df54;p=lttng-tools.git relayd: create an implicit trace chunk on session creation Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index c7760cca4..282bb8461 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -1144,6 +1144,15 @@ static int relay_create_session(const struct lttcomm_relayd_hdr *recv_hdr, reply.session_id = htobe64(session->id); + session->current_trace_chunk = + sessiond_trace_chunk_registry_get_anonymous_chunk( + sessiond_trace_chunk_registry, sessiond_uuid, + session->id, + opt_output_path); + if (!session->current_trace_chunk) { + ret = -1; + } + send_reply: if (ret < 0) { reply.ret_code = htobe32(LTTNG_ERR_FATAL); diff --git a/src/bin/lttng-relayd/session.c b/src/bin/lttng-relayd/session.c index 4730d0512..51b1a3497 100644 --- a/src/bin/lttng-relayd/session.c +++ b/src/bin/lttng-relayd/session.c @@ -164,9 +164,12 @@ static void destroy_session(struct relay_session *session) ret = session_delete(session); assert(!ret); + lttng_trace_chunk_put(session->current_trace_chunk); ret = sessiond_trace_chunk_registry_session_destroyed( sessiond_trace_chunk_registry, session->sessiond_uuid); assert(!ret); + lttng_trace_chunk_put(session->current_trace_chunk); + session->current_trace_chunk = NULL; call_rcu(&session->rcu_node, rcu_destroy_session); } diff --git a/src/bin/lttng-relayd/session.h b/src/bin/lttng-relayd/session.h index 5731310f0..426cd0317 100644 --- a/src/bin/lttng-relayd/session.h +++ b/src/bin/lttng-relayd/session.h @@ -29,6 +29,7 @@ #include #include #include +#include /* * Represents a session for the relay point of view @@ -107,6 +108,7 @@ struct relay_session { * session_list_lock. Traversals are protected by RCU. */ struct cds_list_head viewer_session_node; + struct lttng_trace_chunk *current_trace_chunk; struct rcu_head rcu_node; /* For call_rcu teardown. */ };