]> git.baikalelectronics.ru Git - kernel.git/commit
futex: fix restart in wait_requeue_pi
authorThomas Gleixner <tglx@linutronix.de>
Tue, 19 May 2009 21:04:59 +0000 (23:04 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 20 May 2009 08:34:32 +0000 (10:34 +0200)
commit547839799238c14131685395376cb43adf6f47ad
treef1695bd701f7a2558e11052bfe6ff42d6dc561df
parent3a55e61a7571b489a24207c9c62fa3dc68b8a0b1
futex: fix restart in wait_requeue_pi

If the waiter has been requeued to the outer PI futex and is
interrupted by a signal and the thread handles the signal then
ERESTART_RESTARTBLOCK is changed to EINTR and the restart block is
discarded. That way we return an unexcpected EINTR to user space
instead of ending up in futex_lock_pi_restart.

But we do not need to restart the syscall because we know that the
condition has changed since we have been requeued. If we would simply
restart the syscall then we would drop out via the comparison of the
user space value with EWOULDBLOCK.

The user space side needs to handle EWOULDBLOCK anyway as the
enqueueing on the inner futex can race with a requeue/wake. So we can
simply return EWOULDBLOCK to user space which also signals that we did
not take the outer futex and let user space handle it in the same way
it has to handle the requeue/wake race.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/futex.c