Fix: don't enable a channel if a session was already started
authorDavid Goulet <dgoulet@efficios.com>
Tue, 25 Jun 2013 18:15:41 +0000 (14:15 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 25 Jun 2013 19:16:58 +0000 (15:16 -0400)
This removes also the check done to start the session if it was started
before.

Signed-off-by: David Goulet <dgoulet@efficios.com>
doc/man/lttng.1
src/bin/lttng-sessiond/cmd.c

index e650d24264c27e50b65d59973c26c5935fc69e4f..72454f0d3e85ad0f1c6ffeb8e4221e8251a03a07 100644 (file)
@@ -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.
 
 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:
 .fi
 
 .B OPTIONS:
index a23a2b761eac462a4b48869a36b5138a3b71413f..bba77023a6415ff0b52e9f0dcfde6729c5a0856f 100644 (file)
@@ -856,6 +856,15 @@ int cmd_enable_channel(struct ltt_session *session,
 
        DBG("Enabling channel %s for session %s", attr->name, session->name);
 
 
        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) {
        rcu_read_lock();
 
        switch (domain->type) {
@@ -876,18 +885,6 @@ int cmd_enable_channel(struct ltt_session *session,
                }
 
                kernel_wait_quiescent(kernel_tracer_fd);
                }
 
                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:
                break;
        }
        case LTTNG_DOMAIN_UST:
@@ -902,17 +899,6 @@ int cmd_enable_channel(struct ltt_session *session,
                } else {
                        ret = channel_ust_enable(usess, uchan);
                }
                } 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:
                break;
        }
        default:
@@ -1616,8 +1602,6 @@ int cmd_stop_trace(struct ltt_session *session)
                }
        }
 
                }
        }
 
-       session->started = 0;
-
        ret = LTTNG_OK;
 
 error:
        ret = LTTNG_OK;
 
 error:
This page took 0.028635 seconds and 4 git commands to generate.