[PATCH-rt] rtmutex/rt: don't BUG for -EDEADLK when detect_deadlock is off
Paul Gortmaker <paul.gortmaker <at> windriver.com>
2014-10-16 00:09:24 GMT
The stable cherry pick of commit 3d5c9340d1949733eb37616abd15db36aef9a57c
("rtmutex: Handle deadlock detection smarter") essentially makes the
deadlock_detect flag a no-op, as it says:
Even in the case when deadlock detection is not requested by the
caller, we can detect deadlocks. Right now the code stops the lock
chain walk and keeps the waiter enqueued, even on itself. Silly not to
yell when such a scenario is detected and to keep the waiter enqueued.
Return -EDEADLK unconditionally and handle it at the call sites.
So, as part of that change, we see this:
<at> <at> -453,7 +453,7 <at> <at> static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
* which is wrong, as the other waiter is not in a deadlock
- if (detect_deadlock && owner == task)
+ if (owner == task)
However, as part of the -rt baseline patches, there exists this change
ret = task_blocks_on_rt_mutex(lock, &waiter, self, 0);
Note that the zero in the call to task_blocks_on_rt_mutex is the value
of detect_deadlock; off, but now ignored, and so we get ret = -EDEADLK
which triggers the BUG_ON().