mirror of
https://github.com/drasko/codezero.git
synced 2026-10-24 19:57:28 +02:00
Fixed a nasty spinlock issue with wake_up_all that didn't get caught.
This commit is contained in:
+5
-3
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user