diff options
author | Daniel Drake <dsd@gentoo.org> | 2005-05-01 11:59:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-01 11:59:03 -0400 |
commit | bcf88e1163623e8e8ef2ba7feface9c826a890c9 (patch) | |
tree | b385deef7d18d781d8f9e02af40c7bce3f43885d /fs/proc/base.c | |
parent | 7f261b5f0dccd53ed3a9a95b55c36e24a698a92a (diff) |
[PATCH] procfs: Fix hardlink counts
The pid directories in /proc/ currently return the wrong hardlink count - 3,
when there are actually 4 : ".", "..", "fd", and "task".
This is easy to notice using find(1):
cd /proc/<pid>
find
In the output, you'll see a message similar to:
find: WARNING: Hard link count is wrong for .: this may be a bug in your
filesystem driver. Automatically turning on find's -noleaf option.
Earlier results may have failed to include directories that should have
been searched.
http://bugs.gentoo.org/show_bug.cgi?id=86031
I also noticed that CONFIG_SECURITY can add a 5th: attr, and performed a
similar fix on the task directories too.
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 39fd336cfdb9..4718173af2c8 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1800,8 +1800,12 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct | |||
1800 | inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO; | 1800 | inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO; |
1801 | inode->i_op = &proc_tgid_base_inode_operations; | 1801 | inode->i_op = &proc_tgid_base_inode_operations; |
1802 | inode->i_fop = &proc_tgid_base_operations; | 1802 | inode->i_fop = &proc_tgid_base_operations; |
1803 | inode->i_nlink = 3; | ||
1804 | inode->i_flags|=S_IMMUTABLE; | 1803 | inode->i_flags|=S_IMMUTABLE; |
1804 | #ifdef CONFIG_SECURITY | ||
1805 | inode->i_nlink = 5; | ||
1806 | #else | ||
1807 | inode->i_nlink = 4; | ||
1808 | #endif | ||
1805 | 1809 | ||
1806 | dentry->d_op = &pid_base_dentry_operations; | 1810 | dentry->d_op = &pid_base_dentry_operations; |
1807 | 1811 | ||
@@ -1855,8 +1859,12 @@ static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry | |||
1855 | inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO; | 1859 | inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO; |
1856 | inode->i_op = &proc_tid_base_inode_operations; | 1860 | inode->i_op = &proc_tid_base_inode_operations; |
1857 | inode->i_fop = &proc_tid_base_operations; | 1861 | inode->i_fop = &proc_tid_base_operations; |
1858 | inode->i_nlink = 3; | ||
1859 | inode->i_flags|=S_IMMUTABLE; | 1862 | inode->i_flags|=S_IMMUTABLE; |
1863 | #ifdef CONFIG_SECURITY | ||
1864 | inode->i_nlink = 4; | ||
1865 | #else | ||
1866 | inode->i_nlink = 3; | ||
1867 | #endif | ||
1860 | 1868 | ||
1861 | dentry->d_op = &pid_base_dentry_operations; | 1869 | dentry->d_op = &pid_base_dentry_operations; |
1862 | 1870 | ||