X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=kernel%2Frtmutex.c;h=8cd9bd2cdb34243a89c45102708abdcc2c7cbdbd;hb=5590a536c0bc403fc73908c66c1c88cbed735ecb;hp=180978cb2f7524b180863967be0391d32f47783d;hpb=902b236c087bf021c94cc21a2b09d928c4156c2b;p=linux-2.6-omap-h63xx.git diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c index 180978cb2f7..8cd9bd2cdb3 100644 --- a/kernel/rtmutex.c +++ b/kernel/rtmutex.c @@ -17,12 +17,6 @@ #include "rtmutex_common.h" -#ifdef CONFIG_DEBUG_RT_MUTEXES -# include "rtmutex-debug.h" -#else -# include "rtmutex.h" -#endif - /* * lock->owner state tracking: * @@ -212,6 +206,19 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, if (!waiter || !waiter->task) goto out_unlock_pi; + /* + * Check the orig_waiter state. After we dropped the locks, + * the previous owner of the lock might have released the lock + * and made us the pending owner: + */ + if (orig_waiter && !orig_waiter->task) + goto out_unlock_pi; + + /* + * Drop out, when the task has no waiters. Note, + * top_waiter can be NULL, when we are in the deboosting + * mode! + */ if (top_waiter && (!task_has_pi_waiters(task) || top_waiter != task_top_pi_waiter(task))) goto out_unlock_pi; @@ -659,9 +666,16 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state, * all over without going into schedule to try * to get the lock now: */ - if (unlikely(!waiter.task)) + if (unlikely(!waiter.task)) { + /* + * Reset the return value. We might + * have returned with -EDEADLK and the + * owner released the lock while we + * were walking the pi chain. + */ + ret = 0; continue; - + } if (unlikely(ret)) break; }