Fix double start/stop trace
authorDavid Goulet <dgoulet@efficios.com>
Wed, 15 Feb 2012 00:00:56 +0000 (19:00 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 15 Feb 2012 00:00:59 +0000 (19:00 -0500)
The started flag, use to detect start vs restart, was set to 0 when
stopping tracing which is really not suppose to. An assert has been
addedd to detect a started = 0 at this stage which is a bad execution
flow error.

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/ust-app.c

index bb012b5d84fc0e8b92ace19dde174c2dcb633fef..335c20ff18556f6df3705be8be6440ff14b1f00e 100644 (file)
@@ -2037,10 +2037,12 @@ int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app)
                goto error_rcu_unlock;
        }
 
-       /* Not started, continuing. */
-       if (ua_sess->started == 0) {
-               goto end;
-       }
+       /*
+        * If started = 0, it means that stop trace has been called for a session
+        * that was never started. This is a code flow error and should never
+        * happen.
+        */
+       assert(ua_sess->started == 1);
 
        /* This inhibits UST tracing */
        ret = ustctl_stop_session(app->key.sock, ua_sess->handle);
@@ -2071,8 +2073,6 @@ int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app)
                                ret);
        }
 
-       ua_sess->started = 0;
-
 end:
        rcu_read_unlock();
        return 0;
This page took 0.028861 seconds and 5 git commands to generate.