summaryrefslogtreecommitdiff
path: root/fs/sysfs/mount.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-06-13 22:45:14 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-12 03:09:04 +0400
commit13b3086d2ea483cbcae5a4236446cecc082a72cf (patch)
treef6932aaf486a302aa7b03857d780bafda33db2d6 /fs/sysfs/mount.c
parenta26cd7226c24c3be5dd5f48a74832fe64beb8489 (diff)
downloadlinux-13b3086d2ea483cbcae5a4236446cecc082a72cf.tar.xz
sysfs: add sysfs_dirent->s_parent
Add sysfs_dirent->s_parent. With this patch, each sd points to and holds a reference to its parent. This allows walking sysfs tree without referencing sd->s_dentry which can go away anytime if the user doesn't control when it's deleted. sd->s_parent is initialized and parent is referenced in sysfs_attach_dirent(). Reference to parent is released when the sd is released, so as long as reference to a sd is held, s_parent can be followed. dentry walk in sysfs_readdir() is convereted to s_parent walk. This will be used to reimplement symlink such that it uses only sysfs_dirent tree. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/mount.c')
-rw-r--r--fs/sysfs/mount.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 00ab9125d398..31c1fc67f604 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -28,6 +28,7 @@ static const struct super_operations sysfs_ops = {
};
static struct sysfs_dirent sysfs_root = {
+ .s_count = ATOMIC_INIT(1),
.s_sibling = LIST_HEAD_INIT(sysfs_root.s_sibling),
.s_children = LIST_HEAD_INIT(sysfs_root.s_children),
.s_element = NULL,