X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=lttctl%2Flttctl.c;h=e77b7f38d6833f8abc2cc8dd0fba8b19b9a9c146;hb=635683d75350f395da23354a7524dfd0a1363d48;hp=3011a96f34c88117f237d89b60f47ab3d4079e5e;hpb=323ef0a303f5cfebe4de91df7fbfc9fdc0bd3887;p=ltt-control.git diff --git a/lttctl/lttctl.c b/lttctl/lttctl.c index 3011a96..e77b7f3 100644 --- a/lttctl/lttctl.c +++ b/lttctl/lttctl.c @@ -696,10 +696,13 @@ setup_trace_fail: } /* - * Start a lttd daemon to write trace datas + * Start a lttd daemon to write trace data * Dump overwrite channels on overwrite!=0 * Dump normal(non-overwrite) channels on overwrite=0 * + * When called for overwrite mode, wait for lttd to return, so we are sure that + * trace session teardown is not executed before lttd can grab the buffer data. + * * ret: 0 on success * !0 on fail */ @@ -794,6 +797,16 @@ static int lttctl_daemon(int overwrite) if (WEXITSTATUS(status)) fprintf(stderr, "lttd process running failed\n"); + /* + * FIXME + * This is a temporary hack to ensure that the lttd daemon grabs + * handles on the debugfs buffer files before we destroy the trace + * session. Properly handling this will imply separating the "flush" + * from the "destroy" operation at kernel-level in LTTng. + */ + if (overwrite) + sleep(2); + return WEXITSTATUS(status); }