tracing: Move pipe reference to trace array instead of current_tracer
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 30 Jun 2020 03:45:56 +0000 (23:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:23:49 +0000 (08:23 +0200)
commitf84547c2a6a3d00f48a56e439b6d14e8932f3e98
treecfefaa10a084436e6df4110b61e3d51be6df8d4a
parent3ab15afbf32f101ed5aafa2c5e9566055de0e20c
tracing: Move pipe reference to trace array instead of current_tracer

[ Upstream commit 7ef282e05132d56b6f6b71e3873f317664bea78b ]

If a process has the trace_pipe open on a trace_array, the current tracer
for that trace array should not be changed. This was original enforced by a
global lock, but when instances were introduced, it was moved to the
current_trace. But this structure is shared by all instances, and a
trace_pipe is for a single instance. There's no reason that a process that
has trace_pipe open on one instance should prevent another instance from
changing its current tracer. Move the reference counter to the trace_array
instead.

This is marked as "Fixes" but is more of a clean up than a true fix.
Backport if you want, but its not critical.

Fixes: cf6ab6d9143b1 ("tracing: Add ref count to tracer for when they are being read by pipe")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/trace/trace.c
kernel/trace/trace.h