Commit 3aac072e authored by Chunyu Hu's avatar Chunyu Hu Committed by Kamal Mostafa

tracing: Don't display trigger file for events that can't be enabled

commit 854145e0 upstream.

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

Fixes: 85f2b082 ("tracing: Add basic event trigger framework")
Signed-off-by: default avatarChunyu Hu <chuhu@redhat.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent fe4c8611
...@@ -1626,6 +1626,11 @@ event_create_dir(struct dentry *parent, struct trace_event_file *file) ...@@ -1626,6 +1626,11 @@ event_create_dir(struct dentry *parent, struct trace_event_file *file)
trace_create_file("filter", 0644, file->dir, file, trace_create_file("filter", 0644, file->dir, file,
&ftrace_event_filter_fops); &ftrace_event_filter_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, trace_create_file("trigger", 0644, file->dir, file,
&event_trigger_fops); &event_trigger_fops);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment