Re: [BUG] sunrpc as module and bad proc/sys link count

From: Miklos Szeredi
Date: Fri Aug 05 2005 - 09:01:25 EST


> When sunrpc is as module, sysctl adds to proc fs proc/sys/sunrpc, adds 1
> to number of proc/sys link (see later), but when it's ls-ed, there is
> still old count.

Does this patch solve it?

Index: linux/fs/proc/generic.c
===================================================================
--- linux.orig/fs/proc/generic.c 2005-07-27 12:29:23.000000000 +0200
+++ linux/fs/proc/generic.c 2005-08-05 15:54:35.000000000 +0200
@@ -249,6 +249,18 @@ out:
return error;
}

+static int proc_getattr(struct vfsmount *mnt, struct dentry *dentry,
+ struct kstat *stat)
+{
+ struct inode *inode = dentry->d_inode;
+ struct proc_dir_entry *de = PROC_I(inode)->pde;
+ if (de && de->nlink)
+ inode->i_nlink = de->nlink;
+
+ generic_fillattr(inode, stat);
+ return 0;
+}
+
static struct inode_operations proc_file_inode_operations = {
.setattr = proc_notify_change,
};
@@ -475,6 +487,7 @@ static struct file_operations proc_dir_o
*/
static struct inode_operations proc_dir_inode_operations = {
.lookup = proc_lookup,
+ .getattr = proc_getattr,
.setattr = proc_notify_change,
};

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