From: jeremie.galarneau@efficios.com (Jérémie Galarneau)
Subject: [lttng-dev] [PATCH lttng-tools 03/10] Fix: kernel tracing: flush after stop
Date: Thu, 19 May 2016 00:09:50 -0400 [thread overview]
Message-ID: <CA+jJMxuYEv-MUa8NRu1MNY6FyB3ASV+CSuMO5087YF6i8LcG1w@mail.gmail.com> (raw)
In-Reply-To: <1463594659-10964-4-git-send-email-mathieu.desnoyers@efficios.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2380 bytes --]
Good catch, merged!
Thanks,
Jérémie
On Wed, May 18, 2016 at 2:04 PM, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> We should flush the last packet after stop, not before. Otherwise, we
> may end up with events written immediately after the flush, which
> defeats the purpose of flushing.
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
> src/bin/lttng-sessiond/cmd.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c
> index 16d8ba2..d57edcd 100644
> --- a/src/bin/lttng-sessiond/cmd.c
> +++ b/src/bin/lttng-sessiond/cmd.c
> @@ -2437,7 +2437,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) {
> @@ -2445,7 +2453,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) {
> @@ -2453,14 +2461,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;
> }
>
> --
> 2.1.4
>
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2016-05-19 4:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-18 18:04 [lttng-dev] [PATCH lttng-tools 00/10] Fix: tracefile rotation rm-after-destroy race Mathieu Desnoyers
2016-05-18 18:04 ` [lttng-dev] [PATCH lttng-tools 06/10] Fix: error.h: add missing parenthesis around macro parameter Mathieu Desnoyers
2016-05-19 4:13 ` Jérémie Galarneau
2016-05-18 18:04 ` [lttng-dev] [PATCH lttng-tools 07/10] Fix: WARN() should print as WARN level, not ERR Mathieu Desnoyers
2016-05-19 4:14 ` Jérémie Galarneau
2016-05-18 18:04 ` [lttng-dev] [PATCH lttng-tools 08/10] Add environment variable to allow abort on error Mathieu Desnoyers
2016-05-19 4:45 ` Jérémie Galarneau
2016-05-18 18:04 ` [lttng-dev] [PATCH lttng-tools 09/10] test: kernel tracing destroy flush behavior with tracefile rotation Mathieu Desnoyers
2016-05-19 4:45 ` Jérémie Galarneau
2016-05-18 18:04 ` [lttng-dev] [PATCH lttng-tools 10/10] test: UST " Mathieu Desnoyers
2016-05-19 4:46 ` Jérémie Galarneau
[not found] ` <1463594659-10964-2-git-send-email-mathieu.desnoyers@efficios.com>
2016-05-19 2:57 ` [lttng-dev] [PATCH lttng-tools 01/10] Fix: bad file descriptors on close after rotation error Jérémie Galarneau
[not found] ` <1463594659-10964-3-git-send-email-mathieu.desnoyers@efficios.com>
2016-05-19 4:09 ` [lttng-dev] [PATCH lttng-tools 02/10] Fix: UST should not generate packet at destroy after stop Jérémie Galarneau
[not found] ` <1463594659-10964-4-git-send-email-mathieu.desnoyers@efficios.com>
2016-05-19 4:09 ` Jérémie Galarneau [this message]
[not found] ` <1463594659-10964-5-git-send-email-mathieu.desnoyers@efficios.com>
2016-05-19 4:12 ` [lttng-dev] [PATCH lttng-tools 04/10] Fix: ust-consumer: flush empty packets on snapshot channel Jérémie Galarneau
[not found] ` <1463594659-10964-6-git-send-email-mathieu.desnoyers@efficios.com>
2016-05-19 4:12 ` [lttng-dev] [PATCH lttng-tools 05/10] Fix: bogus mask on error.h PRINT types Jérémie Galarneau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+jJMxuYEv-MUa8NRu1MNY6FyB3ASV+CSuMO5087YF6i8LcG1w@mail.gmail.com \
--to=jeremie.galarneau@efficios.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox