aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_events.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-08-07 16:14:16 -0400
committerSteven Rostedt <rostedt@goodmis.org>2013-03-15 00:34:45 -0400
commit0c8916c34203734d3b05953ebace52d7c2969f16 (patch)
treef975bab6327e974b9f6a274b2e104b6ddd692f0c /kernel/trace/trace_events.c
parent277ba04461c2746cf935353474c0961161951b68 (diff)
tracing: Add rmdir to remove multibuffer instances
Add a method to the hijacked dentry descriptor of the "instances" directory to allow for rmdir to remove an instance of a multibuffer. Example: cd /debug/tracing/instances mkdir hello ls hello/ rmdir hello ls Like the mkdir method, the i_mutex is dropped for the instances directory. The instances directory is created at boot up and can not be renamed or removed. The trace_types_lock mutex is used to synchronize adding and removing of instances. I've run several stress tests with different threads trying to create and delete directories of the same name, and it has stood up fine. Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r--kernel/trace/trace_events.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 58a61302a733..06d6bc275221 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1709,6 +1709,20 @@ __trace_add_event_dirs(struct trace_array *tr)
1709 } 1709 }
1710} 1710}
1711 1711
1712/* Remove the event directory structure for a trace directory. */
1713static void
1714__trace_remove_event_dirs(struct trace_array *tr)
1715{
1716 struct ftrace_event_file *file, *next;
1717
1718 list_for_each_entry_safe(file, next, &tr->events, list) {
1719 list_del(&file->list);
1720 debugfs_remove_recursive(file->dir);
1721 remove_subsystem(file->system);
1722 kfree(file);
1723 }
1724}
1725
1712static void 1726static void
1713__add_event_to_tracers(struct ftrace_event_call *call, 1727__add_event_to_tracers(struct ftrace_event_call *call,
1714 struct ftrace_module_file_ops *file_ops) 1728 struct ftrace_module_file_ops *file_ops)
@@ -1793,6 +1807,25 @@ int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr)
1793 return 0; 1807 return 0;
1794} 1808}
1795 1809
1810int event_trace_del_tracer(struct trace_array *tr)
1811{
1812 /* Disable any running events */
1813 __ftrace_set_clr_event(tr, NULL, NULL, NULL, 0);
1814
1815 mutex_lock(&event_mutex);
1816
1817 down_write(&trace_event_mutex);
1818 __trace_remove_event_dirs(tr);
1819 debugfs_remove_recursive(tr->event_dir);
1820 up_write(&trace_event_mutex);
1821
1822 tr->event_dir = NULL;
1823
1824 mutex_unlock(&event_mutex);
1825
1826 return 0;
1827}
1828
1796static __init int event_trace_enable(void) 1829static __init int event_trace_enable(void)
1797{ 1830{
1798 struct trace_array *tr = top_trace_array(); 1831 struct trace_array *tr = top_trace_array();