* [PATCH] trace-cmd: Plug startup race between flush_threads and recorders
@ 2010-10-15 11:50 Jan Kiszka
2010-10-15 16:33 ` Steven Rostedt
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2010-10-15 11:50 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Linux Kernel Mailing List, linux-trace-users
As the SIGUSR1 handler is so far registered after forking the recorder
child, there is a small race window where a flush sent by the main
process can actually kill the child. Plug this by registering the signal
handlers before the fork. This also allows to unify SIGINT registration.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
trace-cmd.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/trace-cmd.c b/trace-cmd.c
index 9cbe362..f8992a8 100644
--- a/trace-cmd.c
+++ b/trace-cmd.c
@@ -1089,6 +1089,8 @@ static int create_recorder(int cpu)
char *file;
int pid;
+ signal(SIGUSR1, flush);
+
pid = fork();
if (pid < 0)
die("fork");
@@ -1096,9 +1098,6 @@ static int create_recorder(int cpu)
if (pid)
return pid;
- signal(SIGINT, finish);
- signal(SIGUSR1, flush);
-
if (rt_prio)
set_prio(rt_prio);
@@ -1694,9 +1693,9 @@ int main (int argc, char **argv)
set_options();
if (record || extract) {
+ signal(SIGINT, finish);
if (!latency)
start_threads();
- signal(SIGINT, finish);
}
if (extract) {
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] trace-cmd: Plug startup race between flush_threads and recorders
2010-10-15 11:50 [PATCH] trace-cmd: Plug startup race between flush_threads and recorders Jan Kiszka
@ 2010-10-15 16:33 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2010-10-15 16:33 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Steven Rostedt, Linux Kernel Mailing List, linux-trace-users
On Fri, 2010-10-15 at 13:50 +0200, Jan Kiszka wrote:
> As the SIGUSR1 handler is so far registered after forking the recorder
> child, there is a small race window where a flush sent by the main
> process can actually kill the child. Plug this by registering the signal
> handlers before the fork. This also allows to unify SIGINT registration.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Applied, Thanks!
-- Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-15 16:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-15 11:50 [PATCH] trace-cmd: Plug startup race between flush_threads and recorders Jan Kiszka
2010-10-15 16:33 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox