Fix: rotation: hang on destroy when using scheduled rotation based on timer
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index 9552bbb8680f363477b2d56811196862f7e324c4..361ef6dc8206d79b8b810e7143b52c3faea9008a 100644 (file)
@@ -388,7 +388,7 @@ static enum lttng_error_code list_lttng_ust_global_events(char *channel_name,
        node = lttng_ht_iter_get_node_str(&iter);
        if (node == NULL) {
                ret_code = LTTNG_ERR_UST_CHAN_NOT_FOUND;
-               goto end;
+               goto error;
        }
 
        uchan = caa_container_of(&node->node, struct ltt_ust_channel, node.node);
@@ -421,14 +421,14 @@ static enum lttng_error_code list_lttng_ust_global_events(char *channel_name,
                tmp_event = lttng_event_create();
                if (!tmp_event) {
                        ret_code = LTTNG_ERR_NOMEM;
-                       goto end;
+                       goto error;
                }
 
                if (lttng_strncpy(tmp_event->name, uevent->attr.name,
                                LTTNG_SYMBOL_NAME_LEN)) {
                        ret_code = LTTNG_ERR_FATAL;
                        lttng_event_destroy(tmp_event);
-                       goto end;
+                       goto error;
                }
 
                tmp_event->name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
@@ -2819,7 +2819,7 @@ int cmd_start_trace(struct ltt_session *session)
         */
        session->rotated_after_last_stop = false;
 
-       if (session->rotate_timer_period) {
+       if (session->rotate_timer_period && !session->rotation_schedule_timer_enabled) {
                int int_ret = timer_session_rotation_schedule_timer_start(
                                session, session->rotate_timer_period);
 
@@ -3766,8 +3766,8 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
 
                        channel = trace_ust_channel_to_lttng_channel(uchan);
                        if (!channel) {
-                               ret = LTTNG_ERR_NOMEM;
-                               break;
+                               ret_code = LTTNG_ERR_NOMEM;
+                               goto end;
                        }
 
                        extended = (struct lttng_channel_extended *)
@@ -3778,7 +3778,7 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
                        if (ret < 0) {
                                lttng_channel_destroy(channel);
                                ret_code = LTTNG_ERR_UNK;
-                               break;
+                               goto end;
                        }
 
                        extended->discarded_events = discarded_events;
@@ -3789,11 +3789,12 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
                        if (ret) {
                                ERR("Failed to serialize lttng_channel: channel name = '%s'",
                                                channel->name);
+                               lttng_channel_destroy(channel);
                                ret_code = LTTNG_ERR_UNK;
-                               ret = -1;
-                               break;
+                               goto end;
                        }
 
+                       lttng_channel_destroy(channel);
                        i++;
                }
                rcu_read_unlock();
This page took 0.025518 seconds and 4 git commands to generate.