From: Jérémie Galarneau Date: Thu, 1 Aug 2019 20:35:27 +0000 (-0400) Subject: Fix: only create trace chunk if the output of a session supports it X-Git-Tag: v2.12.0-rc1~522 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e2b6b28eb86b7d0391a514f174a566a459b41136;p=lttng-tools.git Fix: only create trace chunk if the output of a session supports it A trace chunk should only be created on the session daemon end when the trace's output supports this notion (2.11+). Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 3bb3aced5..10a6de391 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -2579,7 +2579,8 @@ int cmd_start_trace(struct ltt_session *session) goto error; } - if (session->output_traces && !session->current_trace_chunk) { + if (session->output_traces && !session->current_trace_chunk && + session_output_supports_trace_chunks(session)) { struct lttng_trace_chunk *trace_chunk; trace_chunk = session_create_new_trace_chunk( diff --git a/src/bin/lttng-sessiond/session.c b/src/bin/lttng-sessiond/session.c index 20edd47e4..c4692504b 100644 --- a/src/bin/lttng-sessiond/session.c +++ b/src/bin/lttng-sessiond/session.c @@ -564,9 +564,12 @@ error: goto end_no_move; } -static -bool output_supports_trace_chunks(const struct consumer_output *output) +bool session_output_supports_trace_chunks(const struct ltt_session *session) { + const struct consumer_output *output = session->kernel_session ? + session->kernel_session->consumer : + session->ust_session->consumer; + if (output->type == CONSUMER_DST_LOCAL) { return true; } else { @@ -619,9 +622,6 @@ struct lttng_trace_chunk *session_create_new_trace_chunk( goto error; } - if (!output_supports_trace_chunks(output)) { - goto end; - } next_chunk_id = session->most_recent_chunk_id.is_set ? session->most_recent_chunk_id.value + 1 : 0; diff --git a/src/bin/lttng-sessiond/session.h b/src/bin/lttng-sessiond/session.h index 03d90c2c5..d524df1cc 100644 --- a/src/bin/lttng-sessiond/session.h +++ b/src/bin/lttng-sessiond/session.h @@ -249,4 +249,6 @@ int session_close_trace_chunk(const struct ltt_session *session, struct lttng_trace_chunk *trace_chunk, const enum lttng_trace_chunk_command_type *close_command); +bool session_output_supports_trace_chunks(const struct ltt_session *session); + #endif /* _LTT_SESSION_H */