All of lore.kernel.org
 help / color / mirror / Atom feed
* [tip/urgent] Avoid deadlock in rt_mutex_start_proxy_lock()
@ 2009-08-05 19:05 Darren Hart
  2009-08-06  3:51 ` [tip:core/urgent] rtmutex: " tip-bot for Darren Hart
  0 siblings, 1 reply; 2+ messages in thread
From: Darren Hart @ 2009-08-05 19:05 UTC (permalink / raw)
  To: lkml, , Thomas Gleixner, Peter Zijlstra, Steven Rostedt,
	Ingo Molnar, Dinakar Guniguntala, John Stultz

From: Darren Hart <dvhltc@us.ibm.com>

In the event of a lock steal or owner died, rt_mutex_start_proxy_lock() will
give the rt_mutex to the waiting task, but it fails to release the wait_lock.
This leads to subsequent deadlocks when other tasks try to acquire the
rt_mutex.

I also removed a few extra blank lines that really spaced this routine out.
I must have been high on the \n when I wrote this originally...

Note: This is the mainline version, a separate patch was sent for [RT]

Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
CC: Dinakar Guniguntala <dino@in.ibm.com>
CC: John Stultz <johnstul@us.ibm.com>
---

 kernel/rtmutex.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)


diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index fec77e7..0f2b9bb 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -1039,16 +1039,14 @@ int rt_mutex_start_proxy_lock(struct rt_mutex *lock,
 	if (!rt_mutex_owner(lock) || try_to_steal_lock(lock, task)) {
 		/* We got the lock for task. */
 		debug_rt_mutex_lock(lock);
-
 		rt_mutex_set_owner(lock, task, 0);
-
+		spin_unlock(&lock->wait_lock);
 		rt_mutex_deadlock_account_lock(lock, task);
 		return 1;
 	}
 
 	ret = task_blocks_on_rt_mutex(lock, waiter, task, detect_deadlock);
 
-
 	if (ret && !waiter->task) {
 		/*
 		 * Reset the return value. We might have
-- 
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-08-06  3:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-05 19:05 [tip/urgent] Avoid deadlock in rt_mutex_start_proxy_lock() Darren Hart
2009-08-06  3:51 ` [tip:core/urgent] rtmutex: " tip-bot for Darren Hart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.