aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/exec.c2
-rw-r--r--fs/proc/proc_misc.c3
-rw-r--r--include/linux/pid_namespace.h5
-rw-r--r--kernel/nsproxy.c2
-rw-r--r--kernel/pid.c4
5 files changed, 11 insertions, 5 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 0b09447ae040..6ffb769ed955 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -776,7 +776,7 @@ static int de_thread(struct task_struct *tsk)
776 * so it is safe to do it under read_lock. 776 * so it is safe to do it under read_lock.
777 */ 777 */
778 if (unlikely(tsk->group_leader == child_reaper(tsk))) 778 if (unlikely(tsk->group_leader == child_reaper(tsk)))
779 tsk->nsproxy->pid_ns->child_reaper = tsk; 779 task_active_pid_ns(tsk)->child_reaper = tsk;
780 780
781 zap_other_threads(tsk); 781 zap_other_threads(tsk);
782 read_unlock(&tasklist_lock); 782 read_unlock(&tasklist_lock);
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index d6dc72c78bc1..e0d064e9764e 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -91,7 +91,8 @@ static int loadavg_read_proc(char *page, char **start, off_t off,
91 LOAD_INT(a), LOAD_FRAC(a), 91 LOAD_INT(a), LOAD_FRAC(a),
92 LOAD_INT(b), LOAD_FRAC(b), 92 LOAD_INT(b), LOAD_FRAC(b),
93 LOAD_INT(c), LOAD_FRAC(c), 93 LOAD_INT(c), LOAD_FRAC(c),
94 nr_running(), nr_threads, current->nsproxy->pid_ns->last_pid); 94 nr_running(), nr_threads,
95 task_active_pid_ns(current)->last_pid);
95 return proc_calc_metrics(page, start, off, count, eof, len); 96 return proc_calc_metrics(page, start, off, count, eof, len);
96} 97}
97 98
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index c471c0c6e9ce..d10cb5f75c06 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -39,6 +39,11 @@ static inline void put_pid_ns(struct pid_namespace *ns)
39 kref_put(&ns->kref, free_pid_ns); 39 kref_put(&ns->kref, free_pid_ns);
40} 40}
41 41
42static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk)
43{
44 return tsk->nsproxy->pid_ns;
45}
46
42static inline struct task_struct *child_reaper(struct task_struct *tsk) 47static inline struct task_struct *child_reaper(struct task_struct *tsk)
43{ 48{
44 return init_pid_ns.child_reaper; 49 return init_pid_ns.child_reaper;
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index ac99837e7a04..e981c61304f1 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -87,7 +87,7 @@ static struct nsproxy *create_new_namespaces(unsigned long flags,
87 goto out_ipc; 87 goto out_ipc;
88 } 88 }
89 89
90 new_nsp->pid_ns = copy_pid_ns(flags, tsk->nsproxy->pid_ns); 90 new_nsp->pid_ns = copy_pid_ns(flags, task_active_pid_ns(tsk));
91 if (IS_ERR(new_nsp->pid_ns)) { 91 if (IS_ERR(new_nsp->pid_ns)) {
92 err = PTR_ERR(new_nsp->pid_ns); 92 err = PTR_ERR(new_nsp->pid_ns);
93 goto out_pid; 93 goto out_pid;
diff --git a/kernel/pid.c b/kernel/pid.c
index 42de9af8c524..78c0dbffde65 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -214,7 +214,7 @@ struct pid *alloc_pid(void)
214 int nr = -1; 214 int nr = -1;
215 struct pid_namespace *ns; 215 struct pid_namespace *ns;
216 216
217 ns = current->nsproxy->pid_ns; 217 ns = task_active_pid_ns(current);
218 pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL); 218 pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL);
219 if (!pid) 219 if (!pid)
220 goto out; 220 goto out;
@@ -364,7 +364,7 @@ struct pid *find_ge_pid(int nr)
364 pid = find_pid(nr); 364 pid = find_pid(nr);
365 if (pid) 365 if (pid)
366 break; 366 break;
367 nr = next_pidmap(current->nsproxy->pid_ns, nr); 367 nr = next_pidmap(task_active_pid_ns(current), nr);
368 } while (nr > 0); 368 } while (nr > 0);
369 369
370 return pid; 370 return pid;