From: Mathieu Desnoyers Date: Fri, 16 Aug 2013 20:58:02 +0000 (-0400) Subject: Fix: channels can be _enabled_ after tracing is started, but not created X-Git-Tag: v2.3.0-rc3~43 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4d2a627b679e1f5be7761c71db9e118782cf7627;p=lttng-tools.git Fix: channels can be _enabled_ after tracing is started, but not created Fixes #619 Signed-off-by: Mathieu Desnoyers --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index e9fa3b462..f2043df9c 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -859,15 +859,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->started) { - ret = LTTNG_ERR_TRACE_ALREADY_STARTED; - goto error; - } - switch (domain->type) { case LTTNG_DOMAIN_KERNEL: { @@ -876,6 +867,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->started) { + ret = LTTNG_ERR_TRACE_ALREADY_STARTED; + goto error; + } ret = channel_kernel_create(session->kernel_session, attr, wpipe); if (attr->name[0] != '\0') { session->kernel_session->has_non_default_channel = 1; @@ -899,6 +899,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->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;