aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorDarren Hart <dvhltc@us.ibm.com>2009-10-15 18:30:48 -0400
committerIngo Molnar <mingo@elte.hu>2009-10-16 04:19:18 -0400
commit89061d3d58e1f0742139605dc6a7950aa1ecc019 (patch)
tree4bf78b9d0834975b6e615ced614c74c67d57d52d /kernel/futex.c
parent237c80c5c8fb7ec128cf2a756b550dc41ad7eac7 (diff)
futex: Move drop_futex_key_refs out of spinlock'ed region
When requeuing tasks from one futex to another, the reference held by the requeued task to the original futex location needs to be dropped eventually. Dropping the reference may ultimately lead to a call to "iput_final" and subsequently call into filesystem- specific code - which may be non-atomic. It is therefore safer to defer this drop operation until after the futex_hash_bucket spinlock has been dropped. Originally-From: Helge Bahmann <hcb@chaoticmind.net> Signed-off-by: Darren Hart <dvhltc@us.ibm.com> Cc: <stable@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Dinakar Guniguntala <dino@in.ibm.com> Cc: John Stultz <johnstul@linux.vnet.ibm.com> Cc: Sven-Thorsten Dietrich <sdietrich@novell.com> Cc: John Kacur <jkacur@redhat.com> LKML-Reference: <4AD7A298.5040802@us.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 06938e560ac9..642f3bbaacc7 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1029,7 +1029,6 @@ static inline
1029void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key, 1029void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key,
1030 struct futex_hash_bucket *hb) 1030 struct futex_hash_bucket *hb)
1031{ 1031{
1032 drop_futex_key_refs(&q->key);
1033 get_futex_key_refs(key); 1032 get_futex_key_refs(key);
1034 q->key = *key; 1033 q->key = *key;
1035 1034
@@ -1227,6 +1226,7 @@ retry_private:
1227 */ 1226 */
1228 if (ret == 1) { 1227 if (ret == 1) {
1229 WARN_ON(pi_state); 1228 WARN_ON(pi_state);
1229 drop_count++;
1230 task_count++; 1230 task_count++;
1231 ret = get_futex_value_locked(&curval2, uaddr2); 1231 ret = get_futex_value_locked(&curval2, uaddr2);
1232 if (!ret) 1232 if (!ret)
@@ -1305,6 +1305,7 @@ retry_private:
1305 if (ret == 1) { 1305 if (ret == 1) {
1306 /* We got the lock. */ 1306 /* We got the lock. */
1307 requeue_pi_wake_futex(this, &key2, hb2); 1307 requeue_pi_wake_futex(this, &key2, hb2);
1308 drop_count++;
1308 continue; 1309 continue;
1309 } else if (ret) { 1310 } else if (ret) {
1310 /* -EDEADLK */ 1311 /* -EDEADLK */