[PATCH 2/2][RT] Avoid deadlock in rt_mutex_start_proxy_lock()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 -rt version, I'll send another for mainline.

Signed-off-by: Darren Hart <dvhltc@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
CC: Dinakar Guniguntala <dino@xxxxxxxxxx>
CC: John Stultz <johnstul@xxxxxxxxxx>
CC: John Kacur <jkacur@xxxxxxxxxx>

Index: 2.6.31-rc4-rt1/kernel/rtmutex.c
===================================================================
--- 2.6.31-rc4-rt1.orig/kernel/rtmutex.c	2009-08-05 10:29:39.000000000 -0700
+++ 2.6.31-rc4-rt1/kernel/rtmutex.c	2009-08-05 11:10:22.000000000 -0700
@@ -1517,9 +1517,8 @@ int rt_mutex_start_proxy_lock(struct rt_
	    try_to_steal_lock(lock, task, STEAL_NORMAL)) {
		/* We got the lock for task. */
		debug_rt_mutex_lock(lock);
-
		rt_mutex_set_owner(lock, task, 0);
-
+		atomic_spin_unlock_irqrestore(&lock->wait_lock, flags);
		rt_mutex_deadlock_account_lock(lock, task);
		return 1;
	}
@@ -1527,7 +1526,6 @@ int rt_mutex_start_proxy_lock(struct rt_
	ret = task_blocks_on_rt_mutex(lock, waiter, task, detect_deadlock,
				      flags);

-
	if (ret && !waiter->task) {
		/*
		 * Reset the return value. We might have

--
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux