提交 dddc7ee3 编写于 作者: M Masami Hiramatsu 提交者: Arnaldo Carvalho de Melo

perf probe: Fix an error when deleting probes successfully

Fix a bug in del_perf_probe_events() which returns an error (-ENOENT)
even if the probes are successfully deleted.

This happens only if the probes are on user-apps and not on kernel,
simply because it doesn't clear the previous error.

So, without this fix, we get an error even though events are being
successfully removed.

  ------
  # ./perf probe -x ./perf del_perf_probe_events
  Added new event:
    probe_perf:del_perf_probe_events (on del_perf_probe_events in ...

  You can now use it in all perf tools, such as:

          perf record -e probe_perf:del_perf_probe_events -aR sleep 1

  # ./perf probe -d \*:\*
  Removed event: probe_perf:del_perf_probe_events
    Error: Failed to delete events.
  ------

This fixes the above error.
  ------
  # ./perf probe -d \*:\*
  Removed event: probe_perf:del_perf_probe_events
  ------
Reported-by: NArnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Richard Weinberger <richard@nod.at>
Link: http://lkml.kernel.org/r/20150527083725.23880.45209.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 419e8738
...@@ -2811,13 +2811,14 @@ int del_perf_probe_events(struct strfilter *filter) ...@@ -2811,13 +2811,14 @@ int del_perf_probe_events(struct strfilter *filter)
goto error; goto error;
ret2 = del_trace_probe_events(ufd, filter, unamelist); ret2 = del_trace_probe_events(ufd, filter, unamelist);
if (ret2 < 0 && ret2 != -ENOENT) if (ret2 < 0 && ret2 != -ENOENT) {
ret = ret2; ret = ret2;
else if (ret == -ENOENT && ret2 == -ENOENT) { goto error;
}
if (ret == -ENOENT && ret2 == -ENOENT)
pr_debug("\"%s\" does not hit any event.\n", str); pr_debug("\"%s\" does not hit any event.\n", str);
/* Note that this is silently ignored */ /* Note that this is silently ignored */
ret = 0; ret = 0;
}
error: error:
if (kfd >= 0) { if (kfd >= 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册