All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Masami Hiramatsu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: jolsa@redhat.com, mingo@kernel.org, richard@nod.at,
	linux-kernel@vger.kernel.org, dsahern@gmail.com,
	tglx@linutronix.de, masami.hiramatsu.pt@hitachi.com,
	acme@redhat.com, peterz@infradead.org, acme@kernel.org,
	namhyung@kernel.org, hpa@zytor.com
Subject: [tip:perf/core] perf probe: Fix an error when deleting probes successfully
Date: Wed, 27 May 2015 09:52:57 -0700	[thread overview]
Message-ID: <tip-dddc7ee32fa13efc66afa71ebd83bce545c8392a@git.kernel.org> (raw)
In-Reply-To: <20150527083725.23880.45209.stgit@localhost.localdomain>

Commit-ID:  dddc7ee32fa13efc66afa71ebd83bce545c8392a
Gitweb:     http://git.kernel.org/tip/dddc7ee32fa13efc66afa71ebd83bce545c8392a
Author:     Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Wed, 27 May 2015 17:37:25 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 27 May 2015 12:21:46 -0300

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: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Arnaldo 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.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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) {

  reply	other threads:[~2015-05-27 16:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27  8:37 [PATCH perf/core 1/2] [RESEND] perf probe: Show the error reason comes from invalid DSO Masami Hiramatsu
2015-05-27  8:37 ` [PATCH perf/core 2/2] [BUGFIX] perf probe: Fix an error when deleting probes successfully Masami Hiramatsu
2015-05-27 16:52   ` tip-bot for Masami Hiramatsu [this message]
2015-05-27 12:50 ` [PATCH perf/core 1/2] [RESEND] perf probe: Show the error reason comes from invalid DSO Arnaldo Carvalho de Melo
2015-05-27 23:42   ` Masami Hiramatsu
2015-05-27 16:52 ` [tip:perf/core] " tip-bot for Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-dddc7ee32fa13efc66afa71ebd83bce545c8392a@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=richard@nod.at \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.