X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=ce468db42df274b0cf1b5d893f3901410c3c3b27;hb=e2df7e95a7fc17481c42537d28ade9e1873d5c37;hp=3b776c57634fcfa5f05688a2c7b2c8233fb505b7;hpb=ddbee47f5457a9f06116a86143e3e4831c5419ce;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 3b776c576..ce468db42 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -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; @@ -5167,6 +5176,9 @@ error_close_trace_chunk: session->name); ret_code = LTTNG_ERR_CLOSE_TRACE_CHUNK_FAIL_CONSUMER; } + + lttng_trace_chunk_put(snapshot_trace_chunk); + snapshot_trace_chunk = NULL; error: if (original_ust_consumer_output) { session->ust_session->consumer = original_ust_consumer_output;