• Steven Rostedt (Google)'s avatar
    tracing: Decrement the snapshot if the snapshot trigger fails to register · 2048fdc2
    Steven Rostedt (Google) authored
    Running the ftrace selftests caused the ring buffer mapping test to fail.
    Investigating, I found that the snapshot counter would be incremented
    every time a snapshot trigger was added, even if that snapshot trigger
    failed.
    
     # cd /sys/kernel/tracing
     # echo "snapshot" > events/sched/sched_process_fork/trigger
     # echo "snapshot" > events/sched/sched_process_fork/trigger
     -bash: echo: write error: File exists
    
    That second one that fails increments the snapshot counter but doesn't
    decrement it. It needs to be decremented when the snapshot fails.
    
    Link: https://lore.kernel.org/linux-trace-kernel/20240223013344.729055907@goodmis.org
    
    
    
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Vincent Donnefort <vdonnefort@google.com>
    Fixes: 16f7e48ffc53a ("tracing: Add snapshot refcount")
    Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
    2048fdc2
trace_events_trigger.c 52.1 KB