[PATCH] trace-cmd record: Do not remove instances with -v

Steven Rostedt <[email protected]>
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <[email protected]>
From: "Steven Rostedt (Google)" <[email protected]>

The -v option was extended to delete instances. But this does not make sense
with the 'record' command. It only makes sense with the 'set' command.
Make sure that the 'set' command is used when deleting an instance,
otherwise it can cause adverse effects on the record side.

Link: https://lore.kernel.org/all/[email protected]/

Fixes: 2a3c58e75 ("trace-cmd: Extend option "-v" to delete an ftrace instance")
Reported-by: Jerome Marchand <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>
---
 tracecmd/trace-record.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 4e9ac598..1527be11 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -6748,7 +6748,8 @@ static void parse_record_options(int argc,
 			ctx->instance = allocate_instance(optarg);
 			if (!ctx->instance)
 				die("Failed to create instance");
-			ctx->instance->delete = negative;
+			if (IS_CMDSET(ctx))
+				ctx->instance->delete = negative;
 			negative = 0;
 			if (ctx->instance->delete) {
 				ctx->instance->next = del_list;
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.