Linux-Trace-Devel Archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] trace-cmd reset: Fix -d option
Date: Tue, 9 Jan 2024 23:17:51 -0500	[thread overview]
Message-ID: <20240109231751.1e49addd@gandalf.local.home> (raw)

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

There was a bug where a "trace-cmd record -B foo" would delete the foo
instance when the record was finished even if that instance previously
existed. But that fix was a bit too agreesive. It changed two places:

1) where the bug was, in remove_instance()

2) where the bug was not, in tracecmd_remove_instance() that uses the
instance->flags to know if it should be deleted or not.

The "trace-cmd reset" uses the latter function and if the "-d" option is
set, it is supposed to delete the instance. But because that function was
changed to only delete it if it created it (which reset does not do), it
broke it.

Fixes: 9d6f3baa3 ("trace-cmd record/extract: Do not destroy existing instances")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 tracecmd/trace-record.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 16b73776..3114a664 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -5419,8 +5419,7 @@ void tracecmd_remove_instances(void)
 			close(instance->tracing_on_fd);
 			instance->tracing_on_fd = 0;
 		}
-		if (tracefs_instance_is_new(instance->tracefs))
-			tracefs_instance_destroy(instance->tracefs);
+		tracefs_instance_destroy(instance->tracefs);
 	}
 }
 
-- 
2.42.0


                 reply	other threads:[~2024-01-10  4:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240109231751.1e49addd@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).