lkml.org 
[lkml]   [2007]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sysfs: fix sysfs root inode nlink accounting
Hi Tejun,

On Wed, 18 Jul 2007 14:29:06 +0900, Tejun Heo wrote:
> 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.

This fixed my problem as expected. Thanks a lot!

> Signed-off-by: Tejun Heo <htejun@gmail.com>

For what it's worth:

Acked-by: Jean Delvare <khali@linux-fr.org>

> ---
> fs/sysfs/mount.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> Index: work/fs/sysfs/mount.c
> ===================================================================
> --- work.orig/fs/sysfs/mount.c
> +++ work/fs/sysfs/mount.c
> @@ -43,19 +43,19 @@ static int sysfs_fill_super(struct super
> sb->s_time_gran = 1;
> sysfs_sb = sb;
>
> - inode = new_inode(sysfs_sb);
> + /* get root inode, initialize and unlock it */
> + inode = sysfs_get_inode(&sysfs_root);
> if (!inode) {
> pr_debug("sysfs: could not get root inode\n");
> return -ENOMEM;
> }
>
> - sysfs_init_inode(&sysfs_root, inode);
> -
> inode->i_op = &sysfs_dir_inode_operations;
> inode->i_fop = &sysfs_dir_operations;
> - /* directory inodes start off with i_nlink == 2 (for "." entry) */
> - inc_nlink(inode);
> + inc_nlink(inode); /* directory, account for "." */
> + unlock_new_inode(inode);
>
> + /* instantiate and link root dentry */
> root = d_alloc_root(inode);
> if (!root) {
> pr_debug("%s: could not get root dentry!\n",__FUNCTION__);


--
Jean Delvare
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-18 16:03    [W:0.143 / U:0.456 seconds]
©2003-2014 Jasper Spaans. Advertise on this site