diff options
author | Tejun Heo <htejun@gmail.com> | 2007-07-18 01:29:06 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-18 18:49:49 -0400 |
commit | e080e436f605877e47e4950f5386ed843badbb1b (patch) | |
tree | 87acb330e8978738d013f10206562c89b85a1a7b | |
parent | 2c19c49a59ccf2162c0eb999de1ec60c0e07a533 (diff) |
sysfs: fix sysfs root inode nlink accounting
While making sysfs indoes hashed, sysfs root inode was left out. Now
that nlink accounting depends on the inode being on the hash, sysfs
root inode nlink isn't adjusted properly.
Put sysfs root inode on the inode hash by allocating it using
sysfs_get_inode() like other sysfs inodes. While at it, massage
comments a bit.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | fs/sysfs/mount.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index 402cc356203c..60714d075c2f 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c | |||
@@ -43,19 +43,19 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent) | |||
43 | sb->s_time_gran = 1; | 43 | sb->s_time_gran = 1; |
44 | sysfs_sb = sb; | 44 | sysfs_sb = sb; |
45 | 45 | ||
46 | inode = new_inode(sysfs_sb); | 46 | /* get root inode, initialize and unlock it */ |
47 | inode = sysfs_get_inode(&sysfs_root); | ||
47 | if (!inode) { | 48 | if (!inode) { |
48 | pr_debug("sysfs: could not get root inode\n"); | 49 | pr_debug("sysfs: could not get root inode\n"); |
49 | return -ENOMEM; | 50 | return -ENOMEM; |
50 | } | 51 | } |
51 | 52 | ||
52 | sysfs_init_inode(&sysfs_root, inode); | ||
53 | |||
54 | inode->i_op = &sysfs_dir_inode_operations; | 53 | inode->i_op = &sysfs_dir_inode_operations; |
55 | inode->i_fop = &sysfs_dir_operations; | 54 | inode->i_fop = &sysfs_dir_operations; |
56 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ | 55 | inc_nlink(inode); /* directory, account for "." */ |
57 | inc_nlink(inode); | 56 | unlock_new_inode(inode); |
58 | 57 | ||
58 | /* instantiate and link root dentry */ | ||
59 | root = d_alloc_root(inode); | 59 | root = d_alloc_root(inode); |
60 | if (!root) { | 60 | if (!root) { |
61 | pr_debug("%s: could not get root dentry!\n",__FUNCTION__); | 61 | pr_debug("%s: could not get root dentry!\n",__FUNCTION__); |