mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
selftests: tracing: Fix to unmount tracefs for recovering environment
[ Upstream commit7e021da80f] Fix to unmount the tracefs if the ftracetest mounted it for recovering system environment. If the tracefs is already mounted, this does nothing. Suggested-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/all/29fce076-746c-4650-8358-b4e0fa215cf7@sirena.org.uk/ Fixes:cbd965bde7("ftrace/selftests: Return the skip code when tracing directory not configured in kernel") Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org> Reviewed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ae889fffae
commit
f990052376
@@ -30,6 +30,9 @@ err_ret=1
|
|||||||
# kselftest skip code is 4
|
# kselftest skip code is 4
|
||||||
err_skip=4
|
err_skip=4
|
||||||
|
|
||||||
|
# umount required
|
||||||
|
UMOUNT_DIR=""
|
||||||
|
|
||||||
# cgroup RT scheduling prevents chrt commands from succeeding, which
|
# cgroup RT scheduling prevents chrt commands from succeeding, which
|
||||||
# induces failures in test wakeup tests. Disable for the duration of
|
# induces failures in test wakeup tests. Disable for the duration of
|
||||||
# the tests.
|
# the tests.
|
||||||
@@ -44,6 +47,9 @@ setup() {
|
|||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
echo $sched_rt_runtime_orig > $sched_rt_runtime
|
echo $sched_rt_runtime_orig > $sched_rt_runtime
|
||||||
|
if [ -n "${UMOUNT_DIR}" ]; then
|
||||||
|
umount ${UMOUNT_DIR} ||:
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
errexit() { # message
|
errexit() { # message
|
||||||
@@ -155,11 +161,13 @@ if [ -z "$TRACING_DIR" ]; then
|
|||||||
mount -t tracefs nodev /sys/kernel/tracing ||
|
mount -t tracefs nodev /sys/kernel/tracing ||
|
||||||
errexit "Failed to mount /sys/kernel/tracing"
|
errexit "Failed to mount /sys/kernel/tracing"
|
||||||
TRACING_DIR="/sys/kernel/tracing"
|
TRACING_DIR="/sys/kernel/tracing"
|
||||||
|
UMOUNT_DIR=${TRACING_DIR}
|
||||||
# If debugfs exists, then so does /sys/kernel/debug
|
# If debugfs exists, then so does /sys/kernel/debug
|
||||||
elif [ -d "/sys/kernel/debug" ]; then
|
elif [ -d "/sys/kernel/debug" ]; then
|
||||||
mount -t debugfs nodev /sys/kernel/debug ||
|
mount -t debugfs nodev /sys/kernel/debug ||
|
||||||
errexit "Failed to mount /sys/kernel/debug"
|
errexit "Failed to mount /sys/kernel/debug"
|
||||||
TRACING_DIR="/sys/kernel/debug/tracing"
|
TRACING_DIR="/sys/kernel/debug/tracing"
|
||||||
|
UMOUNT_DIR=${TRACING_DIR}
|
||||||
else
|
else
|
||||||
err_ret=$err_skip
|
err_ret=$err_skip
|
||||||
errexit "debugfs and tracefs are not configured in this kernel"
|
errexit "debugfs and tracefs are not configured in this kernel"
|
||||||
|
|||||||
Reference in New Issue
Block a user