Deadlock while using stack tracer(ftrace)
Issue
-
When writing debugfs/tracing/stack_max_size while reading debugfs/tracing/stack_trace, we got deadlock. Because the 2 actions can be racy, and result in holding the same lock twice.
-
Step to Reproduce:
- echo 1 > /proc/sys/kernel/stack_tracer_enabled
- mount -t debugfs xxx /sys/kernel/debug
- for ((; ;)) ; do echo 1 > /sys/kernel/debug/tracing/stack_max_size; done
- for ((; ;)) ; do cat /sys/kernel/debug/tracing/stack_trace > /dev/null; done
- Then, wait for a while (until transparent hugepage is used.)
- move the task to /cgroup/A/
- rmdir /cgroup/A/B
- Actual Results:
- lockup
- Expected Results:
- Never lockup
Environment
- Red Hat Enterprise Linux RHEL 6.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.