瀏覽代碼

tracing: Only create tracer options files if directory exists

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>
Steven Rostedt (Red Hat) 10 年之前
父節點
當前提交
0f67f04ffc
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      kernel/trace/trace.c

+ 5 - 2
kernel/trace/trace.c

@@ -4172,8 +4172,11 @@ static int tracing_set_tracer(struct trace_array *tr, const char *buf)
 		free_snapshot(tr);
 		free_snapshot(tr);
 	}
 	}
 #endif
 #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);
 		destroy_trace_option_files(topts);
 		topts = create_trace_option_files(tr, t);
 		topts = create_trace_option_files(tr, t);
 	}
 	}