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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux