summaryrefslogtreecommitdiffstats
path: root/include/linux/kernfs.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2014-02-03 14:09:08 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-07 15:52:48 -0800
commit07c7530dd46728e25e938d0eb291f8085435c365 (patch)
treeaf31cc0ecb79794e1294b7781350afc45c1657d2 /include/linux/kernfs.h
parentce8b04aa6c9bdf211b921fdd18c040ea29516b97 (diff)
downloadblackbird-op-linux-07c7530dd46728e25e938d0eb291f8085435c365.tar.gz
blackbird-op-linux-07c7530dd46728e25e938d0eb291f8085435c365.zip
kernfs: invoke dir_ops while holding active ref of the target node
kernfs_dir_ops are currently being invoked without any active reference, which makes it tricky for the invoked operations to determine whether the objects associated those nodes are safe to access and will remain that way for the duration of such operations. kernfs already has active_ref mechanism to deal with this which makes the removal of a given node the synchronization point for gating the file operations. There's no reason for dir_ops to be any different. Update the dir_ops handling so that active_ref is held while the dir_ops are executing. This guarantees that while a dir_ops is executing the target nodes stay alive. As kernfs_dir_ops doesn't have any in-kernel user at this point, this doesn't affect anybody. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/kernfs.h')
-rw-r--r--include/linux/kernfs.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 02ac33435808..58a131ddc6a3 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -111,7 +111,8 @@ struct kernfs_node {
* kernfs_dir_ops may be specified on kernfs_create_root() to support
* directory manipulation syscalls. These optional callbacks are invoked
* on the matching syscalls and can perform any kernfs operations which
- * don't necessarily have to be the exact operation requested.
+ * don't necessarily have to be the exact operation requested. An active
+ * reference is held for each kernfs_node parameter.
*/
struct kernfs_dir_ops {
int (*mkdir)(struct kernfs_node *parent, const char *name,
OpenPOWER on IntegriCloud