Skip to content

Commit 130f77e

Browse files
xemulLinus Torvalds
authored andcommitted
pid namespaces: make proc_flush_task() actually from entries from multiple namespaces
This means that proc_flush_task_mnt() is to be called for many proc mounts and with different ids, depending on the namespace this pid is to be flushed from. Signed-off-by: Pavel Emelyanov <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Sukadev Bhattiprolu <[email protected]> Cc: Paul Menage <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 30e49c2 commit 130f77e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

fs/proc/base.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,8 +2259,22 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid)
22592259

22602260
void proc_flush_task(struct task_struct *task)
22612261
{
2262-
proc_flush_task_mnt(proc_mnt, task->pid,
2263-
thread_group_leader(task) ? 0 : task->tgid);
2262+
int i, leader;
2263+
struct pid *pid, *tgid;
2264+
struct upid *upid;
2265+
2266+
leader = thread_group_leader(task);
2267+
proc_flush_task_mnt(proc_mnt, task->pid, leader ? task->tgid : 0);
2268+
pid = task_pid(task);
2269+
if (pid->level == 0)
2270+
return;
2271+
2272+
tgid = task_tgid(task);
2273+
for (i = 1; i <= pid->level; i++) {
2274+
upid = &pid->numbers[i];
2275+
proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr,
2276+
leader ? 0 : tgid->numbers[i].nr);
2277+
}
22642278
}
22652279

22662280
static struct dentry *proc_pid_instantiate(struct inode *dir,

0 commit comments

Comments
 (0)