Commit fc8691bf authored by Mike Waychison's avatar Mike Waychison Committed by Linus Torvalds

[PATCH] wait_for_completion API extension addition fixes

Fix up signal_pending and timeout paths for wait_for_completion API
extensions.
Signed-off-by: default avatarMike Waychison <michael.waychison@sun.com>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7340ad67
...@@ -3020,15 +3020,17 @@ wait_for_completion_timeout(struct completion *x, unsigned long timeout) ...@@ -3020,15 +3020,17 @@ wait_for_completion_timeout(struct completion *x, unsigned long timeout)
__set_current_state(TASK_UNINTERRUPTIBLE); __set_current_state(TASK_UNINTERRUPTIBLE);
spin_unlock_irq(&x->wait.lock); spin_unlock_irq(&x->wait.lock);
timeout = schedule_timeout(timeout); timeout = schedule_timeout(timeout);
if (!timeout)
goto out;
spin_lock_irq(&x->wait.lock); spin_lock_irq(&x->wait.lock);
if (!timeout) {
__remove_wait_queue(&x->wait, &wait);
goto out;
}
} while (!x->done); } while (!x->done);
__remove_wait_queue(&x->wait, &wait); __remove_wait_queue(&x->wait, &wait);
} }
x->done--; x->done--;
spin_unlock_irq(&x->wait.lock);
out: out:
spin_unlock_irq(&x->wait.lock);
return timeout; return timeout;
} }
EXPORT_SYMBOL(wait_for_completion_timeout); EXPORT_SYMBOL(wait_for_completion_timeout);
...@@ -3048,6 +3050,7 @@ int fastcall __sched wait_for_completion_interruptible(struct completion *x) ...@@ -3048,6 +3050,7 @@ int fastcall __sched wait_for_completion_interruptible(struct completion *x)
do { do {
if (signal_pending(current)) { if (signal_pending(current)) {
ret = -ERESTARTSYS; ret = -ERESTARTSYS;
__remove_wait_queue(&x->wait, &wait);
goto out; goto out;
} }
__set_current_state(TASK_INTERRUPTIBLE); __set_current_state(TASK_INTERRUPTIBLE);
...@@ -3080,21 +3083,23 @@ wait_for_completion_interruptible_timeout(struct completion *x, ...@@ -3080,21 +3083,23 @@ wait_for_completion_interruptible_timeout(struct completion *x,
do { do {
if (signal_pending(current)) { if (signal_pending(current)) {
timeout = -ERESTARTSYS; timeout = -ERESTARTSYS;
goto out_unlock; __remove_wait_queue(&x->wait, &wait);
goto out;
} }
__set_current_state(TASK_INTERRUPTIBLE); __set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_irq(&x->wait.lock); spin_unlock_irq(&x->wait.lock);
timeout = schedule_timeout(timeout); timeout = schedule_timeout(timeout);
if (!timeout)
goto out;
spin_lock_irq(&x->wait.lock); spin_lock_irq(&x->wait.lock);
if (!timeout) {
__remove_wait_queue(&x->wait, &wait);
goto out;
}
} while (!x->done); } while (!x->done);
__remove_wait_queue(&x->wait, &wait); __remove_wait_queue(&x->wait, &wait);
} }
x->done--; x->done--;
out_unlock:
spin_unlock_irq(&x->wait.lock);
out: out:
spin_unlock_irq(&x->wait.lock);
return timeout; return timeout;
} }
EXPORT_SYMBOL(wait_for_completion_interruptible_timeout); EXPORT_SYMBOL(wait_for_completion_interruptible_timeout);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment