diff options
author | Maneesh Soni <maneesh@in.ibm.com> | 2006-03-09 19:40:14 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-20 13:42:59 -0800 |
commit | c516865cfbac0d862d4888df91793ad1e74ffd58 (patch) | |
tree | 432024125976af3e6c87ae5b9e64b6f1cc291f70 /fs/sysfs/symlink.c | |
parent | 22f98c0cd7e003b896ee52ded945081307118745 (diff) | |
download | linux-c516865cfbac0d862d4888df91793ad1e74ffd58.tar.gz linux-c516865cfbac0d862d4888df91793ad1e74ffd58.tar.bz2 linux-c516865cfbac0d862d4888df91793ad1e74ffd58.zip |
[PATCH] sysfs: fix problem with duplicate sysfs directories and files
The following patch checks for existing sysfs_dirent before
preparing new one while creating sysfs directories and files.
Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/symlink.c')
-rw-r--r-- | fs/sysfs/symlink.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index e38d6338a20d..fe23f47f6e43 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c @@ -82,12 +82,13 @@ exit1: int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name) { struct dentry * dentry = kobj->dentry; - int error = 0; + int error = -EEXIST; BUG_ON(!kobj || !kobj->dentry || !name); mutex_lock(&dentry->d_inode->i_mutex); - error = sysfs_add_link(dentry, name, target); + if (!sysfs_dirent_exist(dentry->d_fsdata, name)) + error = sysfs_add_link(dentry, name, target); mutex_unlock(&dentry->d_inode->i_mutex); return error; } |