Fix: keep active session state on redundant start command
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 6 Jan 2020 18:26:54 +0000 (13:26 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 13 Jan 2020 20:52:51 +0000 (15:52 -0500)
Steps to reproduce problem:
  lttng create
  lttng enable-event -u -a
  lttng start
  lttng start
  lttng stop

Yield:

  Session auto-20200106-134455 created.
  Traces will be output to /home/joraj/lttng-traces/auto-20200106-134455
  All UST events are enabled in channel channel0
  Tracing started for session auto-20200106-134455
  Warning: Tracing already started for session auto-20200106-134455
  Warning: Tracing already stopped for session auto-20200106-134455

The "warning" on the "lttng stop" command is invalid.

This was introduced by commit

1f4962443 Fix: sessiond: no rotation performed from null chunk to new chunk

For cases where the session is already active, simply skip all the way to
the end without passing via the error handling path.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: Iaf26090191d3eb940fa419848df8911758e0a6e3
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c

index 4ce2d43fab11159d5ebb64ae4b9147769558ecc7..2c2ce285a676461238703f2cb77a285cdb5a66b6 100644 (file)
@@ -2651,7 +2651,8 @@ int cmd_start_trace(struct ltt_session *session)
        /* Is the session already started? */
        if (session->active) {
                ret = LTTNG_ERR_TRACE_ALREADY_STARTED;
-               goto error;
+               /* Perform nothing */
+               goto end;
        }
 
        if (session->rotation_state == LTTNG_ROTATION_STATE_ONGOING &&
@@ -2779,6 +2780,7 @@ error:
                session->cleared_after_last_stop =
                                session_cleared_after_last_stop;
        }
+end:
        return ret;
 }
 
This page took 0.02848 seconds and 5 git commands to generate.