X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=cc26e6dae004baeab4177f3589a0e837e7deba34;hb=019e9d1b3f94f345fd7a5275ce712302ae5715d8;hp=21422a57deb7c674295f37545ccfba35d1ed2f64;hpb=c228c2fc027cb854cd7f9bd1df0a24c878c70a1e;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 21422a57d..cc26e6dae 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -2447,7 +2447,15 @@ int cmd_stop_trace(struct ltt_session *session) if (ksession && ksession->active) { DBG("Stop kernel tracing"); - /* Flush metadata if exist */ + ret = kernel_stop_session(ksession); + if (ret < 0) { + ret = LTTNG_ERR_KERN_STOP_FAIL; + goto error; + } + + kernel_wait_quiescent(kernel_tracer_fd); + + /* Flush metadata after stopping (if exists) */ if (ksession->metadata_stream_fd >= 0) { ret = kernel_metadata_flush_buffer(ksession->metadata_stream_fd); if (ret < 0) { @@ -2455,7 +2463,7 @@ int cmd_stop_trace(struct ltt_session *session) } } - /* Flush all buffers before stopping */ + /* Flush all buffers after stopping */ cds_list_for_each_entry(kchan, &ksession->channel_list.head, list) { ret = kernel_flush_buffer(kchan); if (ret < 0) { @@ -2463,14 +2471,6 @@ int cmd_stop_trace(struct ltt_session *session) } } - ret = kernel_stop_session(ksession); - if (ret < 0) { - ret = LTTNG_ERR_KERN_STOP_FAIL; - goto error; - } - - kernel_wait_quiescent(kernel_tracer_fd); - ksession->active = 0; }