[PATCH] proc: Simplify and correct proc_flush_task

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric W. Biederman
Date: Friday, October 26, 2007 - 12:43 pm

Currently we special case when we have only the initial pid namespace.
Unfortunately in doing so the copied case for the other namespaces was
broken so we don't properly flush the thread directories :(

So this patch removes the unnecessary special case (removing a
usage of proc_mnt) and corrects the flushing of the thread directories.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/proc/base.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index aeaf0d0..a17c268 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2328,21 +2328,18 @@ out:
 
 void proc_flush_task(struct task_struct *task)
 {
-	int i, leader;
-	struct pid *pid, *tgid;
+	int i;
+	struct pid *pid, *tgid = NULL;
 	struct upid *upid;
 
-	leader = thread_group_leader(task);
-	proc_flush_task_mnt(proc_mnt, task->pid, leader ? task->tgid : 0);
 	pid = task_pid(task);
-	if (pid->level == 0)
-		return;
+	if (thread_group_leader(task))
+		tgid = task_tgid(task);
 
-	tgid = task_tgid(task);
-	for (i = 1; i <= pid->level; i++) {
+	for (i = 0; i <= pid->level; i++) {
 		upid = &pid->numbers[i];
 		proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr,
-				leader ? 0 : tgid->numbers[i].nr);
+			tgid ? tgid->numbers[i].nr : 0);
 	}
 
 	upid = &pid->numbers[pid->level];
-- 
1.5.3.rc6.17.g1911

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] proc: Fix proc_kill_inodes to kill dentries on all ..., Eric W. Biederman, (Fri Oct 26, 10:48 am)
Re: [PATCH] proc: Fix proc_kill_inodes to kill dentries on ..., Eric W. Biederman, (Fri Oct 26, 11:36 am)
[PATCH] proc: Simplify and correct proc_flush_task, Eric W. Biederman, (Fri Oct 26, 12:43 pm)
[PATCH] pidns: Limit kill -1 and cap_set_all, Eric W. Biederman, (Fri Oct 26, 1:37 pm)
Re: [PATCH] pidns: Limit kill -1 and cap_set_all, Kirill Korotaev, (Mon Oct 29, 1:38 am)
Re: [PATCH] pidns: Limit kill -1 and cap_set_all, Dave Hansen, (Mon Oct 29, 9:02 am)
Re: [PATCH] pidns: Limit kill -1 and cap_set_all, Eric W. Biederman, (Mon Oct 29, 10:59 am)
Re: [PATCH] pidns: Limit kill -1 and cap_set_all, Dave Hansen, (Mon Oct 29, 11:07 am)
Re: [PATCH] pidns: Limit kill -1 and cap_set_all, Eric W. Biederman, (Mon Oct 29, 11:07 am)