aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2005-09-06 18:17:18 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 19:57:28 -0400
commit2b579beec255d6589fabe51b60933d723630bcd4 (patch)
tree06c0899b0071ec7cc9b3761c185452fa2c6f243b /fs
parent230649da7cb73914b8b2a1ffc802a2951e970454 (diff)
[PATCH] proc: link count fix
This patch fixes bug titled "sunrpc as module and bad proc/sys link count" reported by Jiri Slaby. The problem was, that only proc_dir_entry->nlink was updated and the corresponding inode->i_nlink was not. The fix is to implement the inode->getattr() method, and update i_nlink (if necessary). A quick audit of proc code shows that no other attribute changes after creation. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/proc/generic.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index abe8920313fb..8a8c34461d48 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -249,6 +249,18 @@ out:
249 return error; 249 return error;
250} 250}
251 251
252static int proc_getattr(struct vfsmount *mnt, struct dentry *dentry,
253 struct kstat *stat)
254{
255 struct inode *inode = dentry->d_inode;
256 struct proc_dir_entry *de = PROC_I(inode)->pde;
257 if (de && de->nlink)
258 inode->i_nlink = de->nlink;
259
260 generic_fillattr(inode, stat);
261 return 0;
262}
263
252static struct inode_operations proc_file_inode_operations = { 264static struct inode_operations proc_file_inode_operations = {
253 .setattr = proc_notify_change, 265 .setattr = proc_notify_change,
254}; 266};
@@ -475,6 +487,7 @@ static struct file_operations proc_dir_operations = {
475 */ 487 */
476static struct inode_operations proc_dir_inode_operations = { 488static struct inode_operations proc_dir_inode_operations = {
477 .lookup = proc_lookup, 489 .lookup = proc_lookup,
490 .getattr = proc_getattr,
478 .setattr = proc_notify_change, 491 .setattr = proc_notify_change,
479}; 492};
480 493