Skip to contentSkip to conversation

trace-cmd record/extract: Do not destroy existing instances

PATCH New Steven Rostedt 1 participant 1 message Jun 1, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd record/extract: Do not destroy existing instances

From: "Steven Rostedt (Google)" <[email protected]>

Do not destroy an instance that already exists when trace-cmd record or extract is executed. There may be state that the user still would like to know about the instance. When doing an extract, it should not delete the instance when it is finished.

---
 tracecmd/trace-record.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tracecmd/trace-record.c +4 -2
index 32fbfef58c26..ded9ea1a04e2 100644
@@ -5295,7 +5295,8 @@ void tracecmd_remove_instances(void)
 			close(instance->tracing_on_fd);
 			instance->tracing_on_fd = 0;
 		}
-		tracefs_instance_destroy(instance->tracefs);
+		if (tracefs_instance_is_new(instance->tracefs))
+			tracefs_instance_destroy(instance->tracefs);
 	}
 }
 
@@ -6055,7 +6056,8 @@ static inline void remove_instances(struct buffer_instance *instances)
 		del = instances;
 		instances = instances->next;
 		free(del->name);
-		tracefs_instance_destroy(del->tracefs);
+		if (tracefs_instance_is_new(del->tracefs))
+			tracefs_instance_destroy(del->tracefs);
 		tracefs_instance_free(del->tracefs);
 		free(del);
 	}
Signature · 1 line
2.39.2