From: James Morris Date: Wed, 22 Mar 2006 08:09:16 +0000 (-0800) Subject: [PATCH] selinuxfs cleanups: fix hard link count X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=40e906f8224966ef65756cc75f9999ea2de0523d;p=openwrt%2Fstaging%2Fblogic.git [PATCH] selinuxfs cleanups: fix hard link count Fix the hard link count for selinuxfs directories, which are currently one short. Signed-off-by: James Morris Acked-by: Stephen Smalley Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index cc782083d71f..4f7cda67ac0a 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -1181,6 +1181,8 @@ static int sel_make_dir(struct super_block *sb, struct dentry *dentry) } inode->i_op = &simple_dir_inode_operations; inode->i_fop = &simple_dir_operations; + /* directory inodes start off with i_nlink == 2 (for "." entry) */ + inode->i_nlink++; d_add(dentry, inode); out: return ret; @@ -1222,6 +1224,8 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent) goto out; inode->i_op = &simple_dir_inode_operations; inode->i_fop = &simple_dir_operations; + /* directory inodes start off with i_nlink == 2 (for "." entry) */ + inode->i_nlink++; d_add(dentry, inode); bool_dir = dentry; ret = sel_make_bools();