Re: wait_for_completion_interruptible() changes

From: Andi Kleen
Date: Thu Oct 18 2007 - 13:41:58 EST


> I suspect this is caused by the recent completion refactoring?

Yes. Here's a patch to fix it.

Fix return value of wait_for_completion_interruptible()

The recent w_f_c() changes broke the return value of
wait_for_completion_interruptible(). Previously it returned 0 on success,
now -1. Fix that.

Problem found by Geert Uytterhoeven

Signed-off-by: Andi Kleen <ak@xxxxxxx>

Index: linux/kernel/sched.c
===================================================================
--- linux/kernel/sched.c
+++ linux/kernel/sched.c
@@ -3751,7 +3751,10 @@ EXPORT_SYMBOL(wait_for_completion_timeou

int __sched wait_for_completion_interruptible(struct completion *x)
{
- return wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_INTERRUPTIBLE);
+ long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_INTERRUPTIBLE);
+ if (t == -ERESTARTSYS)
+ return t;
+ return 0;
}
EXPORT_SYMBOL(wait_for_completion_interruptible);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/