]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/posix-cpu-timers.c
Merge rsync://bughost.org/repos/ieee80211-delta/
[linux-2.6-omap-h63xx.git] / kernel / posix-cpu-timers.c
index 7a51a5597c33e04ad5f3f86d121779189ca326b3..b3f3edc475de16a56b85ef64c45dbcff6805d35b 100644 (file)
@@ -387,25 +387,19 @@ int posix_cpu_timer_del(struct k_itimer *timer)
        if (unlikely(p == NULL))
                return 0;
 
+       spin_lock(&p->sighand->siglock);
        if (!list_empty(&timer->it.cpu.entry)) {
-               read_lock(&tasklist_lock);
-               if (unlikely(p->signal == NULL)) {
-                       /*
-                        * We raced with the reaping of the task.
-                        * The deletion should have cleared us off the list.
-                        */
-                       BUG_ON(!list_empty(&timer->it.cpu.entry));
-               } else {
-                       /*
-                        * Take us off the task's timer list.
-                        */
-                       spin_lock(&p->sighand->siglock);
-                       list_del(&timer->it.cpu.entry);
-                       spin_unlock(&p->sighand->siglock);
-               }
-               read_unlock(&tasklist_lock);
+               /*
+                * Take us off the task's timer list.  We don't need to
+                * take tasklist_lock and check for the task being reaped.
+                * If it was reaped, it already called posix_cpu_timers_exit
+                * and posix_cpu_timers_exit_group to clear all the timers
+                * that pointed to it.
+                */
+               list_del(&timer->it.cpu.entry);
+               put_task_struct(p);
        }
-       put_task_struct(p);
+       spin_unlock(&p->sighand->siglock);
 
        return 0;
 }