summaryrefslogtreecommitdiffstats
path: root/fs/sysfs/dir.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-06-14 03:45:15 +0900
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 16:09:04 -0700
commit2b29ac252afff87b8465b064ca2d9740cf1f6e52 (patch)
tree9f4930db68ace50adc7c11feba12aafe34e2cdbe /fs/sysfs/dir.c
parentaecdcedaab49ca40620dc7dd70f67ee7269a66c9 (diff)
downloadlinux-2b29ac252afff87b8465b064ca2d9740cf1f6e52.tar.gz
linux-2b29ac252afff87b8465b064ca2d9740cf1f6e52.tar.bz2
linux-2b29ac252afff87b8465b064ca2d9740cf1f6e52.zip
sysfs: reimplement symlink using sysfs_dirent tree
sysfs symlink is implemented by referencing dentry and kobject from sysfs_dirent - symlink entry references kobject, dentry is used to walk the tree. This complicates object lifetimes rules and is dangerous - for example, there is no way to tell to which module the target of a symlink belongs and referencing that kobject can make it linger after the module is gone. This patch reimplements symlink using only sysfs_dirent tree. sd for a symlink points and holds reference to the target sysfs_dirent and all walking is done using sysfs_dirent tree. Simpler and safer. Please read the following message for more info. http://article.gmane.org/gmane.linux.kernel/510293 Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r--fs/sysfs/dir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index e9fddcc59447..2a94dc36d166 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -54,7 +54,7 @@ void release_sysfs_dirent(struct sysfs_dirent * sd)
parent_sd = sd->s_parent;
if (sd->s_type & SYSFS_KOBJ_LINK)
- kobject_put(sd->s_elem.symlink.target_kobj);
+ sysfs_put(sd->s_elem.symlink.target_sd);
if (sd->s_type & SYSFS_COPY_NAME)
kfree(sd->s_name);
kfree(sd->s_iattr);