relayd: create an implicit trace chunk on session creation
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 19 Feb 2019 21:48:23 +0000 (16:48 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 25 Jul 2019 19:51:46 +0000 (15:51 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/main.c
src/bin/lttng-relayd/session.c
src/bin/lttng-relayd/session.h

index c7760cca45b67feaac6f7e50b0edb03d7d74e72d..282bb8461b1f97a595958cd75504fdf86fb3b322 100644 (file)
@@ -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);
index 4730d0512e5bdb88e6a29275f18e5faeb5d5d4ce..51b1a3497641549af8faab3775bc76fd02f795c9 100644 (file)
@@ -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);
 }
 
index 5731310f09f6ac7b7e611f648012578072f19a6c..426cd0317ab46785c06ae44c5ed99c8438b0cc9e 100644 (file)
@@ -29,6 +29,7 @@
 #include <lttng/constant.h>
 #include <common/hashtable/hashtable.h>
 #include <common/compat/uuid.h>
+#include <common/trace-chunk.h>
 
 /*
  * 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. */
 };
 
This page took 0.028996 seconds and 4 git commands to generate.