From: David Goulet Date: Wed, 15 Feb 2012 00:00:56 +0000 (-0500) Subject: Fix double start/stop trace X-Git-Tag: v2.0-pre23~5 X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=9bc07046c0e2a572eb3821e276949537614f74e0;p=lttng-tools.git Fix double start/stop trace 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 --- diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index bb012b5d8..335c20ff1 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -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;