pid namespaces: make proc_flush_task() actually from entries from multiple namespaces
[firefly-linux-kernel-4.4.55.git] / fs / proc / base.c
index 50e149e08d962fbeda12fe35c3c65dc1e358cb19..5e0c6a1ce8b34c175c2fc7b3186d4ff873ed72f6 100644 (file)
@@ -2259,8 +2259,22 @@ out:
 
 void proc_flush_task(struct task_struct *task)
 {
-       proc_flush_task_mnt(proc_mnt, task->pid,
-                       thread_group_leader(task) ? 0 : task->tgid);
+       int i, leader;
+       struct pid *pid, *tgid;
+       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;
+
+       tgid = task_tgid(task);
+       for (i = 1; i <= pid->level; i++) {
+               upid = &pid->numbers[i];
+               proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr,
+                               leader ? 0 : tgid->numbers[i].nr);
+       }
 }
 
 static struct dentry *proc_pid_instantiate(struct inode *dir,