tracing: Only create tracer options files if directory exists
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Tue, 3 Feb 2015 16:56:20 +0000 (11:56 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 3 Feb 2015 17:48:38 +0000 (12:48 -0500)
Do not bother creating tracer options if no tracing directory
exists. If a tracer is enabled via the command line, and is
started before the tracing directory is created, then it wont have
its tracer specific options created.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace.c

index 38c613ede10d440257e0be895dd591b8138f8132..d4627f15407a94baf66003fdcbebc76540798161 100644 (file)
@@ -4172,8 +4172,11 @@ static int tracing_set_tracer(struct trace_array *tr, const char *buf)
                free_snapshot(tr);
        }
 #endif
-       /* Currently, only the top instance has options */
-       if (tr->flags & TRACE_ARRAY_FL_GLOBAL) {
+       /*
+        * Only enable if the directory has been created already.
+        * Currently, only the top instance has options
+        */
+       if (tr->dir && tr->flags & TRACE_ARRAY_FL_GLOBAL) {
                destroy_trace_option_files(topts);
                topts = create_trace_option_files(tr, t);
        }