From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> 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. Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> --- tracecmd/trace-record.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index 32fbfef58c26..ded9ea1a04e2 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -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); } -- 2.39.2