From 9bc07046c0e2a572eb3821e276949537614f74e0 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 14 Feb 2012 19:00:56 -0500 Subject: [PATCH] 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 --- src/bin/lttng-sessiond/ust-app.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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; -- 2.34.1