* [BUG] sunrpc as module and bad proc/sys link count
@ 2005-08-05 12:54 Jiri Slaby
2005-08-05 13:57 ` Miklos Szeredi
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2005-08-05 12:54 UTC (permalink / raw)
To: Linux Kernel Mailing List
Hello.
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.
I.e.
my proc/sys before modprobe-ing sunrpc:
# ls -la /proc/sys
celkem 0
dr-xr-xr-x 9 root root 0 srp 5 12:43 .
dr-xr-xr-x 114 root root 0 srp 5 2005 ..
dr-xr-xr-x 2 root root 0 srp 5 14:33 debug
dr-xr-xr-x 4 root root 0 srp 5 14:33 dev
dr-xr-xr-x 5 root root 0 srp 5 12:43 fs
drwxr-xr-x 5 root root 0 srp 5 14:33 kernel
dr-xr-xr-x 7 root root 0 srp 5 14:33 net
dr-xr-xr-x 2 root root 0 srp 5 14:33 proc
dr-xr-xr-x 2 root root 0 srp 5 14:33 vm
# stat /proc/sys
File: `/proc/sys'
Size: 0 Blocks: 0 IO Block: 1024 directory
Device: 3h/3d Inode: -268435429 Links: 9
*[BTW This seems like bad interpretation of the un/signed number (real
inode from ls out is 4026531867.]*
Access: (0555/dr-xr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2005-08-05 12:43:12.066160750 +0200
Modify: 2005-08-05 12:43:12.066160750 +0200
Change: 2005-08-05 12:43:12.066160750 +0200
after:
#modprobe sunrpc
#ls -la /proc/sys
celkem 0
dr-xr-xr-x 9 root root 0 srp 5 12:43 . <-- The 9 here should be now 10
dr-xr-xr-x 114 root root 0 srp 5 2005 ..
dr-xr-xr-x 2 root root 0 srp 5 14:35 debug
dr-xr-xr-x 4 root root 0 srp 5 14:35 dev
dr-xr-xr-x 5 root root 0 srp 5 12:43 fs
drwxr-xr-x 5 root root 0 srp 5 14:35 kernel
dr-xr-xr-x 7 root root 0 srp 5 14:35 net
dr-xr-xr-x 2 root root 0 srp 5 14:35 proc
dr-xr-xr-x 2 root root 0 srp 5 14:35 sunrpc
dr-xr-xr-x 2 root root 0 srp 5 14:35 vm
# stat /proc/sys
File: `/proc/sys'
Size: 0 Blocks: 0 IO Block: 1024 directory
Device: 3h/3d Inode: -268435429 Links: 9
Access: (0555/dr-xr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2005-08-05 12:43:12.066160750 +0200
Modify: 2005-08-05 12:43:12.066160750 +0200
Change: 2005-08-05 12:43:12.066160750 +0200
When I add printk to proc/generic.c into create_proc_entry before and
after proc_register, it prints 9 and after 10 (so the nlink is added here).
On the other side, when sunrpc is in the kernel (not as module) it works
fine, and the count returned by proc fs is 10, so ok.
This appears in kernels 2.6.11.12 through 2.6.13-rc4-mm1, maybe in older
kernels too.
--
Jiri Slaby www.fi.muni.cz/~xslaby
~\-/~ jirislaby@gmail.com ~\-/~
241B347EC88228DE51EE A49C4A73A25004CB2A10
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] sunrpc as module and bad proc/sys link count
2005-08-05 12:54 [BUG] sunrpc as module and bad proc/sys link count Jiri Slaby
@ 2005-08-05 13:57 ` Miklos Szeredi
2005-08-05 20:13 ` Jiri Slaby
0 siblings, 1 reply; 3+ messages in thread
From: Miklos Szeredi @ 2005-08-05 13:57 UTC (permalink / raw)
To: jirislaby; +Cc: linux-kernel
> 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,
};
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] sunrpc as module and bad proc/sys link count
2005-08-05 13:57 ` Miklos Szeredi
@ 2005-08-05 20:13 ` Jiri Slaby
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2005-08-05 20:13 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: linux-kernel
Miklos Szeredi napsal(a):
> Does this patch solve it?
Yes, you can post.
--
Jiri Slaby www.fi.muni.cz/~xslaby
~\-/~ jirislaby@gmail.com ~\-/~
241B347EC88228DE51EE A49C4A73A25004CB2A10
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-08-05 20:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-05 12:54 [BUG] sunrpc as module and bad proc/sys link count Jiri Slaby
2005-08-05 13:57 ` Miklos Szeredi
2005-08-05 20:13 ` Jiri Slaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox