From: David Goulet Date: Tue, 25 Jun 2013 18:15:41 +0000 (-0400) Subject: Fix: don't enable a channel if a session was already started X-Git-Tag: v2.2.0~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d2f11c4a439e76804369810907e2a22dfcd0956f;p=lttng-tools.git Fix: don't enable a channel if a session was already started This removes also the check done to start the session if it was started before. Signed-off-by: David Goulet --- diff --git a/doc/man/lttng.1 b/doc/man/lttng.1 index e650d2426..72454f0d3 100644 --- a/doc/man/lttng.1 +++ b/doc/man/lttng.1 @@ -312,8 +312,8 @@ It is important to note that if a certain type of buffers is used, the session will be set with that type and all other subsequent channel needs to have the same type. -For the kernel tracer (\-k), once the session is started at least once, it's -not possible anymore to enable new channel for that session. +Note that once the session has been started and enabled on the tracer side, +it's not possible anymore to enable a new channel for that session. .fi .B OPTIONS: diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index a23a2b761..bba77023a 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -856,6 +856,15 @@ int cmd_enable_channel(struct ltt_session *session, DBG("Enabling channel %s for session %s", attr->name, session->name); + /* + * 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->started) { + ret = LTTNG_ERR_TRACE_ALREADY_STARTED; + goto error; + } + rcu_read_lock(); switch (domain->type) { @@ -876,18 +885,6 @@ int cmd_enable_channel(struct ltt_session *session, } kernel_wait_quiescent(kernel_tracer_fd); - - /* - * If the session was previously started, start as well this newly - * created kernel session so the events/channels enabled *after* the - * start actually work. - */ - if (session->started && !session->kernel_session->started) { - ret = start_kernel_session(session->kernel_session, wpipe); - if (ret != LTTNG_OK) { - goto error; - } - } break; } case LTTNG_DOMAIN_UST: @@ -902,17 +899,6 @@ int cmd_enable_channel(struct ltt_session *session, } else { ret = channel_ust_enable(usess, uchan); } - - /* Start the UST session if the session was already started. */ - if (session->started && !usess->start_trace) { - ret = ust_app_start_trace_all(usess); - if (ret < 0) { - ret = LTTNG_ERR_UST_START_FAIL; - goto error; - } - ret = LTTNG_OK; - usess->start_trace = 1; - } break; } default: @@ -1616,8 +1602,6 @@ int cmd_stop_trace(struct ltt_session *session) } } - session->started = 0; - ret = LTTNG_OK; error: