tracing: Have mkdir and rmdir be part of tracefs
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Wed, 21 Jan 2015 15:01:39 +0000 (10:01 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 3 Feb 2015 17:48:43 +0000 (12:48 -0500)
commiteae473581cf93dad94ca833aa961c033c6a43924
treeea0a8bbf8a30940b497dad43a858be8d1b5efb26
parentcc31004a4aa784d89054ec07b87eae05cecf7121
tracing: Have mkdir and rmdir be part of tracefs

The tracing "instances" directory can create sub tracing buffers
with mkdir, and remove them with rmdir. As a mkdir will also create
all the files and directories that control the sub buffer the inode
mutexes need to be released before this is done, to avoid deadlocks.
It is better to let the tracing system unlock the inode mutexes before
calling the functions that create the files within the new directory
(or deletes the files from the one being destroyed).

Now that tracing has been converted over to tracefs, the tracefs file
system can be modified to accommodate this feature. It still releases
the locks, but the filesystem itself can take care of the ugly
business and let the user just do what it needs.

The tracing system now attaches a descriptor to the directory dentry
that can have userspace create or remove sub directories. If this
descriptor does not exist for a dentry, then that dentry can not be
used to create other directories. This descriptor holds a mkdir and
rmdir method that only takes a character string as an argument.

The tracefs file system will first make a copy of the dentry name
before releasing the locks. Then it will pass the copied name to the
methods. It is up to the tracing system that supplied the methods to
handle races with duplicate names and such as all the inode mutexes
would be released when the functions are called.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
fs/tracefs/inode.c
include/linux/tracefs.h
kernel/trace/trace.c