tracing/ftrace: check if debugfs is registered before creating files
authorFrederic Weisbecker <fweisbec@gmail.com>
Sun, 22 Mar 2009 22:10:45 +0000 (23:10 +0100)
committerIngo Molnar <mingo@elte.hu>
Mon, 23 Mar 2009 15:25:47 +0000 (16:25 +0100)
commit3e1f60b80cafcb5d7e8d3665b35962fbb8fb9efa
tree80b07264a2599f494f9f8eebb7230ceead3ae645
parentc0f92ba99bdeaf35f9c580291b4e1a657c67fbd4
tracing/ftrace: check if debugfs is registered before creating files

Impact: fix a crash with ftrace={nop,boot} parameter

If the nop or initcall tracers are launched as boot tracers,
they will attempt to create their option directory and files.
But these tracers are registered very early and then assigned
as "boot tracers" very early if asked to.

Since they do this before debugfs has been registered (core initcall),
a crash is triggered.

Another early tracers could also come later. So we fix it by
checking if debugfs is initialized before creating the root
tracing directory.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1237759847-21025-3-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/trace.c