sysctl: make kernel.ns_last_pid control dependent on CHECKPOINT_RESTORE
[pandora-kernel.git] / kernel / pid_namespace.c
index 57bc1fd..16b20e3 100644 (file)
@@ -149,7 +149,12 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
 {
        int nr;
        int rc;
-       struct task_struct *task;
+       struct task_struct *task, *me = current;
+
+       /* Ignore SIGCHLD causing any terminated children to autoreap */
+       spin_lock_irq(&me->sighand->siglock);
+       me->sighand->action[SIGCHLD - 1].sa.sa_handler = SIG_IGN;
+       spin_unlock_irq(&me->sighand->siglock);
 
        /*
         * The last thread in the cgroup-init thread group is terminating.
@@ -191,6 +196,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
        return;
 }
 
+#ifdef CONFIG_CHECKPOINT_RESTORE
 static int pid_ns_ctl_handler(struct ctl_table *table, int write,
                void __user *buffer, size_t *lenp, loff_t *ppos)
 {
@@ -218,8 +224,8 @@ static struct ctl_table pid_ns_ctl_table[] = {
        },
        { }
 };
-
 static struct ctl_path kern_path[] = { { .procname = "kernel", }, { } };
+#endif /* CONFIG_CHECKPOINT_RESTORE */
 
 int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd)
 {
@@ -253,7 +259,10 @@ int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd)
 static __init int pid_namespaces_init(void)
 {
        pid_ns_cachep = KMEM_CACHE(pid_namespace, SLAB_PANIC);
+
+#ifdef CONFIG_CHECKPOINT_RESTORE
        register_sysctl_paths(kern_path, pid_ns_ctl_table);
+#endif
        return 0;
 }