/[linux-patches]/genpatches-2.6/trunk/2.6.12-pre/2910_procfs-task-hardlinks.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.12-pre/2910_procfs-task-hardlinks.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (show annotations) (download) (as text)
Sat Jun 11 23:20:41 2005 UTC (15 years, 5 months ago) by dsd
File MIME type: text/x-diff
File size: 1590 byte(s)
Create 2.6.12 branch
1 The current logic assumes that a /proc/<PID>/task directory should have a
2 hardlink count of 3, probably counting ".", "..", and a directory for a single
3 child task.
4
5 It's fairly obvious that this doesn't work out correctly when a PID has more
6 than one child task, which is quite often the case.
7
8 This should fix it up.
9
10 Signed-off-by: Daniel Drake <dsd@gentoo.org>
11
12 --- linux-2.6.11-gentoo-r5/fs/proc/base.c.orig 2005-04-02 20:47:10.000000000 +0100
13 +++ linux-2.6.11-gentoo-r5/fs/proc/base.c 2005-04-02 20:51:43.000000000 +0100
14 @@ -1337,6 +1337,8 @@ static struct file_operations proc_tgid_
15 static struct inode_operations proc_tgid_attr_inode_operations;
16 #endif
17
18 +static int get_tid_list(int index, unsigned int *tids, struct inode *dir);
19 +
20 /* SMP-safe */
21 static struct dentry *proc_pident_lookup(struct inode *dir,
22 struct dentry *dentry,
23 @@ -1376,7 +1378,7 @@ static struct dentry *proc_pident_lookup
24 */
25 switch(p->type) {
26 case PROC_TGID_TASK:
27 - inode->i_nlink = 3;
28 + inode->i_nlink = 2 + get_tid_list(2, NULL, dir);
29 inode->i_op = &proc_task_inode_operations;
30 inode->i_fop = &proc_task_operations;
31 break;
32 @@ -1845,7 +1847,8 @@ static int get_tid_list(int index, unsig
33
34 if (--index >= 0)
35 continue;
36 - tids[nr_tids] = tid;
37 + if (tids != NULL)
38 + tids[nr_tids] = tid;
39 nr_tids++;
40 if (nr_tids >= PROC_MAXPIDS)
41 break;
42 @@ -1945,6 +1948,7 @@ static int proc_task_readdir(struct file
43 }
44
45 nr_tids = get_tid_list(pos, tid_array, inode);
46 + inode->i_nlink = pos + nr_tids;
47
48 for (i = 0; i < nr_tids; i++) {
49 unsigned long j = PROC_NUMBUF;

  ViewVC Help
Powered by ViewVC 1.1.20