aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/posix-cpu-timers.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-10-21 18:36:00 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-21 18:36:00 -0400
commit9465bee863bc4c6cf1566c12d6f92a8133e3da5c (patch)
tree339f5d3f7554afe2226eb6bdf9fa63851ae73311 /kernel/posix-cpu-timers.c
parent0213df74315bbab9ccaa73146f3e11972ea6de46 (diff)
Revert "Fix cpu timers exit deadlock and races"
Revert commit e03d13e985d48ac4885382c9e3b1510c78bd047f, to be replaced by a much nicer fix from Roland.
Diffstat (limited to 'kernel/posix-cpu-timers.c')
-rw-r--r--kernel/posix-cpu-timers.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index b3f3edc475d..7a51a5597c3 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -387,19 +387,25 @@ int posix_cpu_timer_del(struct k_itimer *timer)
387 if (unlikely(p == NULL)) 387 if (unlikely(p == NULL))
388 return 0; 388 return 0;
389 389
390 spin_lock(&p->sighand->siglock);
391 if (!list_empty(&timer->it.cpu.entry)) { 390 if (!list_empty(&timer->it.cpu.entry)) {
392 /* 391 read_lock(&tasklist_lock);
393 * Take us off the task's timer list. We don't need to 392 if (unlikely(p->signal == NULL)) {
394 * take tasklist_lock and check for the task being reaped. 393 /*
395 * If it was reaped, it already called posix_cpu_timers_exit 394 * We raced with the reaping of the task.
396 * and posix_cpu_timers_exit_group to clear all the timers 395 * The deletion should have cleared us off the list.
397 * that pointed to it. 396 */
398 */ 397 BUG_ON(!list_empty(&timer->it.cpu.entry));
399 list_del(&timer->it.cpu.entry); 398 } else {
400 put_task_struct(p); 399 /*
400 * Take us off the task's timer list.
401 */
402 spin_lock(&p->sighand->siglock);
403 list_del(&timer->it.cpu.entry);
404 spin_unlock(&p->sighand->siglock);
405 }
406 read_unlock(&tasklist_lock);
401 } 407 }
402 spin_unlock(&p->sighand->siglock); 408 put_task_struct(p);
403 409
404 return 0; 410 return 0;
405} 411}