]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - kernel/exit.c
[PATCH] lightweight robust futexes: core
[mirror_ubuntu-zesty-kernel.git] / kernel / exit.c
index 531aadca553030543b643a0553f6144785d02bb5..aecb48ca7370800e0e0d802cfbf64867d78cef4b 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/signal.h>
 #include <linux/cn_proc.h>
 #include <linux/mutex.h>
+#include <linux/futex.h>
 
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
@@ -345,9 +346,9 @@ void daemonize(const char *name, ...)
        exit_mm(current);
 
        set_special_pids(1, 1);
-       down(&tty_sem);
+       mutex_lock(&tty_mutex);
        current->signal->tty = NULL;
-       up(&tty_sem);
+       mutex_unlock(&tty_mutex);
 
        /* Block and flush all signals */
        sigfillset(&blocked);
@@ -807,8 +808,6 @@ fastcall NORET_TYPE void do_exit(long code)
                panic("Attempted to kill the idle task!");
        if (unlikely(tsk->pid == 1))
                panic("Attempted to kill init!");
-       if (tsk->io_context)
-               exit_io_context();
 
        if (unlikely(current->ptrace & PT_TRACE_EXIT)) {
                current->ptrace_message = code;
@@ -822,6 +821,8 @@ fastcall NORET_TYPE void do_exit(long code)
        if (unlikely(tsk->flags & PF_EXITING)) {
                printk(KERN_ALERT
                        "Fixing recursive fault but reboot is needed!\n");
+               if (tsk->io_context)
+                       exit_io_context();
                set_current_state(TASK_UNINTERRUPTIBLE);
                schedule();
        }
@@ -852,6 +853,8 @@ fastcall NORET_TYPE void do_exit(long code)
                exit_itimers(tsk->signal);
                acct_process(code);
        }
+       if (unlikely(tsk->robust_list))
+               exit_robust_list(tsk);
        exit_mm(tsk);
 
        exit_sem(tsk);
@@ -881,6 +884,9 @@ fastcall NORET_TYPE void do_exit(long code)
         */
        mutex_debug_check_no_locks_held(tsk);
 
+       if (tsk->io_context)
+               exit_io_context();
+
        /* PF_DEAD causes final put_task_struct after we schedule. */
        preempt_disable();
        BUG_ON(tsk->flags & PF_DEAD);