linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trace-cmd reset: Fix -d option
@ 2024-01-10  4:17 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2024-01-10  4:17 UTC (permalink / raw)
  To: Linux Trace Devel

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-10  4:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10  4:17 [PATCH] trace-cmd reset: Fix -d option Steven Rostedt

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 NNTP newsgroup(s).