X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;fp=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=5868c829f689d7015fc839ff8048197e182b5ea0;hb=19bfbd16a509837bbe57f9c00d6c2a1f0933a5a9;hp=a635c6511e3722a1356a66ccc337a760693f9c13;hpb=77ef9153bfe46228f4f5d2c02d7e89ce76d5658b;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index a635c6511..5868c829f 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1507,15 +1507,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 @@ -1564,6 +1555,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. */ @@ -1623,6 +1623,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;