lkml.org 
[lkml]   [2015]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH perf/core 2/2] [BUGFIX] perf probe: Fix an error when deleting probes successfully
From
Date
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 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
------

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
---
tools/perf/util/probe-event.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index f5be411..97da984 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2811,13 +2811,14 @@ int del_perf_probe_events(struct strfilter *filter)
goto error;

ret2 = del_trace_probe_events(ufd, filter, unamelist);
- if (ret2 < 0 && ret2 != -ENOENT)
+ if (ret2 < 0 && ret2 != -ENOENT) {
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);
/* Note that this is silently ignored */
- ret = 0;
- }
+ ret = 0;

error:
if (kfd >= 0) {



\
 
 \ /
  Last update: 2015-05-27 11:01    [W:0.091 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site