futex: Fix uninterruptible loop due to gate_area
[linux-2.6.git] / kernel / rtmutex-debug.c
index 56d73cb..3c7cbc2 100644 (file)
@@ -37,8 +37,8 @@ do {                                                          \
        if (rt_trace_on) {                                      \
                rt_trace_on = 0;                                \
                console_verbose();                              \
-               if (spin_is_locked(&current->pi_lock))          \
-                       spin_unlock(&current->pi_lock);         \
+               if (raw_spin_is_locked(&current->pi_lock))      \
+                       raw_spin_unlock(&current->pi_lock);     \
        }                                                       \
 } while (0)
 
@@ -130,7 +130,7 @@ void debug_rt_mutex_deadlock(int detect, struct rt_mutex_waiter *act_waiter,
 
        task = rt_mutex_owner(act_waiter->lock);
        if (task && task != current) {
-               act_waiter->deadlock_task_pid = task->pid;
+               act_waiter->deadlock_task_pid = get_pid(task_pid(task));
                act_waiter->deadlock_lock = lock;
        }
 }
@@ -142,9 +142,12 @@ void debug_rt_mutex_print_deadlock(struct rt_mutex_waiter *waiter)
        if (!waiter->deadlock_lock || !rt_trace_on)
                return;
 
-       task = find_task_by_pid(waiter->deadlock_task_pid);
-       if (!task)
+       rcu_read_lock();
+       task = pid_task(waiter->deadlock_task_pid, PIDTYPE_PID);
+       if (!task) {
+               rcu_read_unlock();
                return;
+       }
 
        TRACE_OFF_NOLOCK();
 
@@ -173,6 +176,7 @@ void debug_rt_mutex_print_deadlock(struct rt_mutex_waiter *waiter)
                current->comm, task_pid_nr(current));
        dump_stack();
        debug_show_all_locks();
+       rcu_read_unlock();
 
        printk("[ turning off deadlock detection."
               "Please report this trace. ]\n\n");
@@ -203,13 +207,14 @@ void debug_rt_mutex_init_waiter(struct rt_mutex_waiter *waiter)
        memset(waiter, 0x11, sizeof(*waiter));
        plist_node_init(&waiter->list_entry, MAX_PRIO);
        plist_node_init(&waiter->pi_list_entry, MAX_PRIO);
+       waiter->deadlock_task_pid = NULL;
 }
 
 void debug_rt_mutex_free_waiter(struct rt_mutex_waiter *waiter)
 {
+       put_pid(waiter->deadlock_task_pid);
        TRACE_WARN_ON(!plist_node_empty(&waiter->list_entry));
        TRACE_WARN_ON(!plist_node_empty(&waiter->pi_list_entry));
-       TRACE_WARN_ON(waiter->task);
        memset(waiter, 0x22, sizeof(*waiter));
 }