From: Thomas Gleixner simplifies the glibc handling of the possible race from userspace tasks which try to get hold of the lock and cleanup the mess which was leftover by the unexpectedly died previous owner. Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar Signed-off-by: Andrew Morton --- kernel/futex.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff -puN kernel/futex.c~futex-pi-enforce-waiter-bit-when-owner-died-is-detected kernel/futex.c --- 25/kernel/futex.c~futex-pi-enforce-waiter-bit-when-owner-died-is-detected Wed Apr 26 14:24:21 2006 +++ 25-akpm/kernel/futex.c Wed Apr 26 14:24:21 2006 @@ -1161,11 +1161,16 @@ static int futex_lock_pi(u32 __user *uad * failed. When the OWNER_DIED bit is set, then we * know that this is a robust futex and we actually * take the lock. This is safe as we are protected by - * the hash bucket lock. + * the hash bucket lock. We also set the waiters bit + * unconditionally here, to simplify glibc handling of + * multiple tasks racing to acquire the lock and + * cleanup the problems which were left by the dead + * owner. */ if (curval & FUTEX_OWNER_DIED) { uval = newval; - newval = current->pid | FUTEX_OWNER_DIED; + newval = current->pid | + FUTEX_OWNER_DIED | FUTEX_WAITERS; inc_preempt_count(); curval = futex_atomic_cmpxchg_inatomic(uaddr, _