Commit 5d6c97c55984b3b991400692f9e8568a702b93c0

Authored by Steven Rostedt (Red Hat)
Committed by Steven Rostedt
1 parent 17a280ea81

tracing: Do not try to recreated toplevel set_ftrace_* files

With the restructing of the function tracer working with instances, the
"top level" buffer is a bit special, as the function tracing is mapped
to the same set of filters. This is done by using a "global_ops" descriptor
and having the "set_ftrace_filter" and "set_ftrace_notrace" map to it.

When an instance is created, it creates the same files but its for the
local instance and not the global_ops.

The issues is that the local instance creation shares some code with
the global instance one and we end up trying to create th top level
"set_ftrace_*" files twice, and on boot up, we get an error like this:

 Could not create debugfs 'set_ftrace_filter' entry
 Could not create debugfs 'set_ftrace_notrace' entry

The reason they failed to be created was because they were created
twice, and the second time gives this error as you can not create the
same file twice.

Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Showing 1 changed file with 10 additions and 6 deletions Side-by-side Diff

kernel/trace/trace_functions.c
... ... @@ -58,12 +58,16 @@
58 58 {
59 59 int ret;
60 60  
61   - /* The top level array uses the "global_ops". */
62   - if (!(tr->flags & TRACE_ARRAY_FL_GLOBAL)) {
63   - ret = allocate_ftrace_ops(tr);
64   - if (ret)
65   - return ret;
66   - }
  61 + /*
  62 + * The top level array uses the "global_ops", and the files are
  63 + * created on boot up.
  64 + */
  65 + if (tr->flags & TRACE_ARRAY_FL_GLOBAL)
  66 + return 0;
  67 +
  68 + ret = allocate_ftrace_ops(tr);
  69 + if (ret)
  70 + return ret;
67 71  
68 72 ftrace_create_filter_files(tr->ops, parent);
69 73