Fix: relayd: `!vsession->current_trace_chunk` assertion failed
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index 284f2921b2d551eb588d26ed2a03016dae9c7cfd..a7990ece4ec524fff33f307f569d0c573a821650 100644 (file)
@@ -1387,15 +1387,6 @@ int cmd_enable_channel(struct ltt_session *session,
 
        rcu_read_lock();
 
-       /*
-        * Don't try to enable a channel if the session has been started at
-        * some point in time before. The tracer does not allow it.
-        */
-       if (session->has_been_started) {
-               ret = LTTNG_ERR_TRACE_ALREADY_STARTED;
-               goto error;
-       }
-
        /*
         * If the session is a live session, remove the switch timer, the
         * live timer does the same thing but sends also synchronisation
@@ -1444,6 +1435,15 @@ int cmd_enable_channel(struct ltt_session *session,
                kchan = trace_kernel_get_channel_by_name(attr.name,
                                session->kernel_session);
                if (kchan == NULL) {
+                       /*
+                        * Don't try to create a channel if the session has been started at
+                        * some point in time before. The tracer does not allow it.
+                        */
+                       if (session->has_been_started) {
+                               ret = LTTNG_ERR_TRACE_ALREADY_STARTED;
+                               goto error;
+                       }
+
                        if (session->snapshot.nb_output > 0 ||
                                        session->snapshot_mode) {
                                /* Enforce mmap output for snapshot sessions. */
@@ -1503,6 +1503,15 @@ int cmd_enable_channel(struct ltt_session *session,
 
                uchan = trace_ust_find_channel_by_name(chan_ht, attr.name);
                if (uchan == NULL) {
+                       /*
+                        * Don't try to create a channel if the session has been started at
+                        * some point in time before. The tracer does not allow it.
+                        */
+                       if (session->has_been_started) {
+                               ret = LTTNG_ERR_TRACE_ALREADY_STARTED;
+                               goto error;
+                       }
+
                        ret = channel_ust_create(usess, &attr, domain->buf_type);
                        if (attr.name[0] != '\0') {
                                usess->has_non_default_channel = 1;
@@ -3241,6 +3250,7 @@ void cmd_destroy_session_reply(const struct ltt_session *session,
        payload_size_before_location = payload.size;
        comm_ret = lttng_trace_archive_location_serialize(location,
                        &payload);
+       lttng_trace_archive_location_put(location);
        if (comm_ret < 0) {
                ERR("Failed to serialize the location of the trace archive produced during the destruction of session \"%s\"",
                                session->name);
@@ -4635,6 +4645,7 @@ enum lttng_error_code cmd_list_triggers(struct command_ctx *cmd_ctx,
                struct notification_thread_handle *notification_thread,
                struct lttng_triggers **return_triggers)
 {
+       int ret;
        enum lttng_error_code ret_code;
        struct lttng_triggers *triggers = NULL;
 
@@ -4645,6 +4656,12 @@ enum lttng_error_code cmd_list_triggers(struct command_ctx *cmd_ctx,
                goto end;
        }
 
+       ret = lttng_triggers_remove_hidden_triggers(triggers);
+       if (ret) {
+               ret_code = LTTNG_ERR_UNK;
+               goto end;
+       }
+
        *return_triggers = triggers;
        triggers = NULL;
        ret_code = LTTNG_OK;
This page took 0.025659 seconds and 4 git commands to generate.