diff options
| author | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-28 08:29:59 -0400 |
|---|---|---|
| committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-28 08:29:59 -0400 |
| commit | 185a257f2f73bcd89050ad02da5bedbc28fc43fa (patch) | |
| tree | 5e32586114534ed3f2165614cba3d578f5d87307 /fs/sysfs/symlink.c | |
| parent | 3f1a9aaeffd8d1cbc5ab9776c45cbd66af1c9699 (diff) | |
| parent | a77c64c1a641950626181b4857abb701d8f38ccc (diff) | |
Merge branch 'master' into gfs2
Diffstat (limited to 'fs/sysfs/symlink.c')
| -rw-r--r-- | fs/sysfs/symlink.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index d2eac3ceed5f..f50e3cc2ded8 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | */ | 3 | */ |
| 4 | 4 | ||
| 5 | #include <linux/fs.h> | 5 | #include <linux/fs.h> |
| 6 | #include <linux/mount.h> | ||
| 6 | #include <linux/module.h> | 7 | #include <linux/module.h> |
| 7 | #include <linux/kobject.h> | 8 | #include <linux/kobject.h> |
| 8 | #include <linux/namei.h> | 9 | #include <linux/namei.h> |
| @@ -82,10 +83,19 @@ exit1: | |||
| 82 | */ | 83 | */ |
| 83 | int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name) | 84 | int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name) |
| 84 | { | 85 | { |
| 85 | struct dentry * dentry = kobj->dentry; | 86 | struct dentry *dentry = NULL; |
| 86 | int error = -EEXIST; | 87 | int error = -EEXIST; |
| 87 | 88 | ||
| 88 | BUG_ON(!kobj || !kobj->dentry || !name); | 89 | BUG_ON(!name); |
| 90 | |||
| 91 | if (!kobj) { | ||
| 92 | if (sysfs_mount && sysfs_mount->mnt_sb) | ||
| 93 | dentry = sysfs_mount->mnt_sb->s_root; | ||
| 94 | } else | ||
| 95 | dentry = kobj->dentry; | ||
| 96 | |||
| 97 | if (!dentry) | ||
| 98 | return -EFAULT; | ||
| 89 | 99 | ||
| 90 | mutex_lock(&dentry->d_inode->i_mutex); | 100 | mutex_lock(&dentry->d_inode->i_mutex); |
| 91 | if (!sysfs_dirent_exist(dentry->d_fsdata, name)) | 101 | if (!sysfs_dirent_exist(dentry->d_fsdata, name)) |
