Commit 44d00dc7 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Steven Rostedt (VMware)

tracing/probe: Fix to allow user to enable events on unloaded modules

Fix to allow user to enable probe events on unloaded modules.

This operations was allowed before commit 60d53e2c ("tracing/probe:
Split trace_event related data from trace_probe"), because if users
need to probe module init functions, they have to enable those probe
events before loading module.

Link: http://lkml.kernel.org/r/156879693733.31056.9331322616994665167.stgit@devnote2

Cc: stable@vger.kernel.org
Fixes: 60d53e2c ("tracing/probe: Split trace_event related data from trace_probe")
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 604e3548
...@@ -371,31 +371,24 @@ static int enable_trace_kprobe(struct trace_event_call *call, ...@@ -371,31 +371,24 @@ static int enable_trace_kprobe(struct trace_event_call *call,
if (enabled) if (enabled)
return 0; return 0;
enabled = false;
list_for_each_entry(pos, trace_probe_probe_list(tp), list) { list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
tk = container_of(pos, struct trace_kprobe, tp); tk = container_of(pos, struct trace_kprobe, tp);
if (trace_kprobe_has_gone(tk)) if (trace_kprobe_has_gone(tk))
continue; continue;
ret = __enable_trace_kprobe(tk); ret = __enable_trace_kprobe(tk);
if (ret) { if (ret)
if (enabled) {
__disable_trace_kprobe(tp);
enabled = false;
}
break; break;
}
enabled = true; enabled = true;
} }
if (!enabled) { if (ret) {
/* No probe is enabled. Roll back */ /* Failed to enable one of them. Roll back all */
if (enabled)
__disable_trace_kprobe(tp);
if (file) if (file)
trace_probe_remove_file(tp, file); trace_probe_remove_file(tp, file);
else else
trace_probe_clear_flag(tp, TP_FLAG_PROFILE); trace_probe_clear_flag(tp, TP_FLAG_PROFILE);
if (!ret)
/* Since all probes are gone, this is not available */
ret = -EADDRNOTAVAIL;
} }
return ret; return ret;
......
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