Commit e5f39047 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] Remove Futex Warning

If we're waiting on a futex and we are woken up, it's either because
someone did FUTEX_WAKE, we timed out, or have been signalled.  However, the
WARN_ON(!signal_pending(current)) test is overzealous: with threads (a
common use of futexes), we share the signal handler and the other
thread might get to the signal before us.  In addition, exit_notify()
can do a recalc_sigpending_tsk() on us, which will then clear our
TIF_SIGPENDING bit, making signal_pending(current) return false.

Returning EINTR is a little strange in this case, since this thread
hasn't handled a signal.  However, with threads it's the best we can
do: there's always a race where another thread could have been the
actual one to handle the signal.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7f357f99
......@@ -553,8 +553,8 @@ static int futex_wait(unsigned long uaddr, int val, unsigned long time)
return 0;
if (time == 0)
return -ETIMEDOUT;
/* A spurious wakeup should never happen. */
WARN_ON(!signal_pending(current));
/* We expect signal_pending(current), but another thread may
* have handled it for us already. */
return -EINTR;
out_unqueue:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment