lkml.org 
[lkml]   [2006]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 2/4] futex-pi: Enforce waiter bit when owner died is detected

Enforce the waiter bit to be set, when the previous owner has died. This
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 <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

kernel/futex.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6.17-rc1-mm3/kernel/futex.c
===================================================================
--- linux-2.6.17-rc1-mm3.orig/kernel/futex.c
+++ linux-2.6.17-rc1-mm3/kernel/futex.c
@@ -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,
--

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

\
 
 \ /
  Last update: 2006-04-25 18:42    [W:0.215 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site