X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=kernel%2Fwait.c;h=5cdf169d7c2317ff05298c7aa329bb6766554277;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=791681cfea981d49e5b9f74de41f928c1c8da38b;hpb=cee37fe97739d85991964371c1f3a745c00dd236;p=linux-2.6.git diff --git a/kernel/wait.c b/kernel/wait.c index 791681cfe..5cdf169d7 100644 --- a/kernel/wait.c +++ b/kernel/wait.c @@ -33,13 +33,35 @@ void fastcall add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait) } EXPORT_SYMBOL(add_wait_queue_exclusive); -void fastcall remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait) +int fastcall remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait) { unsigned long flags; + struct list_head *list; + int seen, retval; spin_lock_irqsave(&q->lock, flags); - __remove_wait_queue(q, wait); + list = &q->task_list; + seen = 0; + retval = -1; + + do { + struct list_head *next; + if (list == &wait->task_list) + seen++; + next = list->next; + if (next->prev != list) { + seen += 2; + break; + } + list = next; + } while (list != &q->task_list); + + if (seen == 1) { + __remove_wait_queue(q, wait); + retval = 0; + } spin_unlock_irqrestore(&q->lock, flags); + return retval; } EXPORT_SYMBOL(remove_wait_queue);