summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChunyu Hu <chuhu@redhat.com>2016-05-03 19:34:34 +0800
committerSasha Levin <sasha.levin@oracle.com>2016-05-17 13:42:56 -0400
commit3216eb22857e515aa89f594f84c0ef2a36a59b08 (patch)
tree34662aa7b071ad615ecd342b37f57f4776291b96
parent9abc9e72c77166342589d02fb7c0dcabe78d9358 (diff)
downloadlwn-3216eb22857e515aa89f594f84c0ef2a36a59b08.tar.gz
lwn-3216eb22857e515aa89f594f84c0ef2a36a59b08.zip
tracing: Don't display trigger file for events that can't be enabled
[ Upstream commit 854145e0a8e9a05f7366d240e2f99d9c1ca6d6dd ] Currently register functions for events will be called through the 'reg' field of event class directly without any check when seting up triggers. Triggers for events that don't support register through debug fs (events under events/ftrace are for trace-cmd to read event format, and most of them don't have a register function except events/ftrace/functionx) can't be enabled at all, and an oops will be hit when setting up trigger for those events, so just not creating them is an easy way to avoid the oops. Link: http://lkml.kernel.org/r/1462275274-3911-1-git-send-email-chuhu@redhat.com Cc: stable@vger.kernel.org # 3.14+ Fixes: 85f2b08268c01 ("tracing: Add basic event trigger framework") Signed-off-by: Chunyu Hu <chuhu@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rw-r--r--kernel/trace/trace_events.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index f69ec1295b0b..6459f77e2c72 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1626,8 +1626,13 @@ event_create_dir(struct dentry *parent, struct ftrace_event_file *file)
trace_create_file("filter", 0644, file->dir, file,
&ftrace_event_filter_fops);
- trace_create_file("trigger", 0644, file->dir, file,
- &event_trigger_fops);
+ /*
+ * Only event directories that can be enabled should have
+ * triggers.
+ */
+ if (!(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE))
+ trace_create_file("trigger", 0644, file->dir, file,
+ &event_trigger_fops);
trace_create_file("format", 0444, file->dir, call,
&ftrace_event_format_fops);