diff options
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index b048ad8a11af..3aaa5c8cb421 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -4398,22 +4398,20 @@ do_wait_for_common(struct completion *x, long timeout, int state) | |||
4398 | signal_pending(current)) || | 4398 | signal_pending(current)) || |
4399 | (state == TASK_KILLABLE && | 4399 | (state == TASK_KILLABLE && |
4400 | fatal_signal_pending(current))) { | 4400 | fatal_signal_pending(current))) { |
4401 | __remove_wait_queue(&x->wait, &wait); | 4401 | timeout = -ERESTARTSYS; |
4402 | return -ERESTARTSYS; | 4402 | break; |
4403 | } | 4403 | } |
4404 | __set_current_state(state); | 4404 | __set_current_state(state); |
4405 | spin_unlock_irq(&x->wait.lock); | 4405 | spin_unlock_irq(&x->wait.lock); |
4406 | timeout = schedule_timeout(timeout); | 4406 | timeout = schedule_timeout(timeout); |
4407 | spin_lock_irq(&x->wait.lock); | 4407 | spin_lock_irq(&x->wait.lock); |
4408 | if (!timeout) { | 4408 | } while (!x->done && timeout); |
4409 | __remove_wait_queue(&x->wait, &wait); | ||
4410 | return timeout; | ||
4411 | } | ||
4412 | } while (!x->done); | ||
4413 | __remove_wait_queue(&x->wait, &wait); | 4409 | __remove_wait_queue(&x->wait, &wait); |
4410 | if (!x->done) | ||
4411 | return timeout; | ||
4414 | } | 4412 | } |
4415 | x->done--; | 4413 | x->done--; |
4416 | return timeout; | 4414 | return timeout ?: 1; |
4417 | } | 4415 | } |
4418 | 4416 | ||
4419 | static long __sched | 4417 | static long __sched |