From 682e7be5a94f3ef9d9fe940604cb89ad0295ecb6 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Thu, 6 Dec 2007 12:29:54 -0500 Subject: [PATCH] --- yaml --- r: 81772 b: refs/heads/master c: 009e577e079656d51d0fe9b15e61e41b00816c29 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/completion.h | 1 + trunk/kernel/sched.c | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index db92bae6dbfc..258060d4d556 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1411d5a7fbe7dce1568b6f0a94c7cbc69eed1bfe +refs/heads/master: 009e577e079656d51d0fe9b15e61e41b00816c29 diff --git a/trunk/include/linux/completion.h b/trunk/include/linux/completion.h index 33d6aaf94447..d2961b66d53d 100644 --- a/trunk/include/linux/completion.h +++ b/trunk/include/linux/completion.h @@ -44,6 +44,7 @@ static inline void init_completion(struct completion *x) extern void wait_for_completion(struct completion *); extern int wait_for_completion_interruptible(struct completion *x); +extern int wait_for_completion_killable(struct completion *x); extern unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout); extern unsigned long wait_for_completion_interruptible_timeout( diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index 50a0faae585f..d2f77fab0f46 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -3881,8 +3881,10 @@ do_wait_for_common(struct completion *x, long timeout, int state) wait.flags |= WQ_FLAG_EXCLUSIVE; __add_wait_queue_tail(&x->wait, &wait); do { - if (state == TASK_INTERRUPTIBLE && - signal_pending(current)) { + if ((state == TASK_INTERRUPTIBLE && + signal_pending(current)) || + (state == TASK_KILLABLE && + fatal_signal_pending(current))) { __remove_wait_queue(&x->wait, &wait); return -ERESTARTSYS; } @@ -3942,6 +3944,15 @@ wait_for_completion_interruptible_timeout(struct completion *x, } EXPORT_SYMBOL(wait_for_completion_interruptible_timeout); +int __sched wait_for_completion_killable(struct completion *x) +{ + long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_KILLABLE); + if (t == -ERESTARTSYS) + return t; + return 0; +} +EXPORT_SYMBOL(wait_for_completion_killable); + static long __sched sleep_on_common(wait_queue_head_t *q, int state, long timeout) {