diff mbox series

libtracefs: Have tracefs_{tracing,debug}_dir() mount {tracefs,debugfs} if not mounted

Message ID 20221208110739.6b2015df@gandalf.local.home (mailing list archive)
State Accepted
Commit 32acbbfb661701aa1cb18175c7103bce4eae5a8d
Headers show
Series libtracefs: Have tracefs_{tracing,debug}_dir() mount {tracefs,debugfs} if not mounted | expand

Commit Message

Steven Rostedt Dec. 8, 2022, 4:07 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

tracefs_tracing_dir() and tracefs_debug_dir() would try to mount the
directories if they were not already mounted. But this broke, fix it.

Link: https://lore.kernel.org/all/20221128132106.291101-1-beanhuo@iokpp.de/

Reported-by: Bean Huo <beanhuo@iokpp.de>
Fixes: 7c2b882ed1 ("libtracefs: Add tracefs_tracing_dir_is_mounted() API")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/tracefs-utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/tracefs-utils.c b/src/tracefs-utils.c
index 777912e46821..d91ff40eee87 100644
--- a/src/tracefs-utils.c
+++ b/src/tracefs-utils.c
@@ -245,7 +245,7 @@  const char *tracefs_tracing_dir(void)
 	if (tracing_dir)
 		return tracing_dir;
 
-	tracing_dir = trace_find_tracing_dir(false);
+	tracing_dir = find_tracing_dir(false, true);
 	return tracing_dir;
 }
 
@@ -263,7 +263,7 @@  const char *tracefs_debug_dir(void)
 	if (debug_dir)
 		return debug_dir;
 
-	debug_dir = trace_find_tracing_dir(true);
+	debug_dir = find_tracing_dir(true, true);
 	return debug_dir;
 }