Re: wait_for_completion_interruptible() changes

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andi Kleen
Date: Thursday, October 18, 2007 - 10:41 am

> 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@suse.de>

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);
 
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
wait_for_completion_interruptible() changes, Geert Uytterhoeven, (Thu Oct 18, 10:05 am)
Re: wait_for_completion_interruptible() changes, Andi Kleen, (Thu Oct 18, 10:41 am)
Re: wait_for_completion_interruptible() changes, Ingo Molnar, (Thu Oct 18, 12:20 pm)