Fixed a nasty spinlock issue with wake_up_all that didn't get caught.

This commit is contained in:
Bahadir Balban
2009-10-31 20:47:20 +02:00
parent 638df9e238
commit c763679aaa
6 changed files with 67 additions and 15 deletions
+5 -3
View File
@@ -107,11 +107,11 @@ int wait_on(struct waitqueue_head *wqh)
return 0;
}
/* Wake up all - FIXME: this is buggy with double spin_unlock */
/* Wake up all in the queue */
void wake_up_all(struct waitqueue_head *wqh, unsigned int flags)
{
BUG_ON(wqh->sleepers < 0);
spin_lock(&wqh->slock);
BUG_ON(wqh->sleepers < 0);
while (wqh->sleepers > 0) {
struct waitqueue *wq = link_to_struct(wqh->task_list.next,
struct waitqueue,
@@ -130,6 +130,8 @@ void wake_up_all(struct waitqueue_head *wqh, unsigned int flags)
sched_resume_sync(sleeper);
else
sched_resume_async(sleeper);
spin_lock(&wqh->slock);
}
spin_unlock(&wqh->slock);
}
@@ -150,7 +152,7 @@ void wake_up(struct waitqueue_head *wqh, unsigned int flags)
task_unset_wqh(sleeper);
if (flags & WAKEUP_INTERRUPT)
sleeper->flags |= TASK_INTERRUPTED;
// printk("(%d) Waking up (%d)\n", current->tid, sleeper->tid);
//printk("(%d) Waking up (%d)\n", current->tid, sleeper->tid);
spin_unlock(&wqh->slock);
if (flags & WAKEUP_SYNC)