aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 577f160131bd..bebf9788f45e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4398,32 +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 4408 } while (!x->done && timeout);
4409 /*
4410 * If the completion has arrived meanwhile
4411 * then return 1 jiffy time left:
4412 */
4413 if (x->done && !timeout) {
4414 timeout = 1;
4415 break;
4416 }
4417
4418 if (!timeout) {
4419 __remove_wait_queue(&x->wait, &wait);
4420 return timeout;
4421 }
4422 } while (!x->done);
4423 __remove_wait_queue(&x->wait, &wait); 4409 __remove_wait_queue(&x->wait, &wait);
4410 if (!x->done)
4411 return timeout;
4424 } 4412 }
4425 x->done--; 4413 x->done--;
4426 return timeout; 4414 return timeout ?: 1;
4427} 4415}
4428 4416
4429static long __sched 4417static long __sched