From: Daniel Drake <dsd@gentoo.org>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] procfs: Fix hardlink counts
Date: Fri, 01 Apr 2005 14:47:03 +0100 [thread overview]
Message-ID: <424D50D7.1000503@gentoo.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 685 bytes --]
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>
[-- Attachment #2: procfs-hardlinks.patch --]
[-- Type: text/x-patch, Size: 935 bytes --]
--- linux-2.6.11-gentoo-r5/fs/proc/base.c.orig 2005-04-01 14:06:43.000000000 +0100
+++ linux-2.6.11-gentoo-r5/fs/proc/base.c 2005-04-01 14:35:39.000000000 +0100
@@ -1702,8 +1702,12 @@ struct dentry *proc_pid_lookup(struct in
inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO;
inode->i_op = &proc_tgid_base_inode_operations;
inode->i_fop = &proc_tgid_base_operations;
- inode->i_nlink = 3;
inode->i_flags|=S_IMMUTABLE;
+#ifdef CONFIG_SECURITY
+ inode->i_nlink = 5;
+#else
+ inode->i_nlink = 4;
+#endif
dentry->d_op = &pid_base_dentry_operations;
@@ -1757,8 +1761,12 @@ static struct dentry *proc_task_lookup(s
inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO;
inode->i_op = &proc_tid_base_inode_operations;
inode->i_fop = &proc_tid_base_operations;
- inode->i_nlink = 3;
inode->i_flags|=S_IMMUTABLE;
+#ifdef CONFIG_SECURITY
+ inode->i_nlink = 4;
+#else
+ inode->i_nlink = 3;
+#endif
dentry->d_op = &pid_base_dentry_operations;
reply other threads:[~2005-04-01 13:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=424D50D7.1000503@gentoo.org \
--to=dsd@gentoo.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.