diff options
Diffstat (limited to 'kernel/rtmutex.c')
-rw-r--r-- | kernel/rtmutex.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c index 12879f6c1ec3..a6fbb4130521 100644 --- a/kernel/rtmutex.c +++ b/kernel/rtmutex.c | |||
@@ -189,6 +189,19 @@ int rt_mutex_adjust_prio_chain(struct task_struct *task, | |||
189 | if (!waiter || !waiter->task) | 189 | if (!waiter || !waiter->task) |
190 | goto out_unlock_pi; | 190 | goto out_unlock_pi; |
191 | 191 | ||
192 | /* | ||
193 | * Check the orig_waiter state. After we dropped the locks, | ||
194 | * the previous owner of the lock might have released the lock | ||
195 | * and made us the pending owner: | ||
196 | */ | ||
197 | if (orig_waiter && !orig_waiter->task) | ||
198 | goto out_unlock_pi; | ||
199 | |||
200 | /* | ||
201 | * Drop out, when the task has no waiters. Note, | ||
202 | * top_waiter can be NULL, when we are in the deboosting | ||
203 | * mode! | ||
204 | */ | ||
192 | if (top_waiter && (!task_has_pi_waiters(task) || | 205 | if (top_waiter && (!task_has_pi_waiters(task) || |
193 | top_waiter != task_top_pi_waiter(task))) | 206 | top_waiter != task_top_pi_waiter(task))) |
194 | goto out_unlock_pi; | 207 | goto out_unlock_pi; |
@@ -636,9 +649,16 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state, | |||
636 | * all over without going into schedule to try | 649 | * all over without going into schedule to try |
637 | * to get the lock now: | 650 | * to get the lock now: |
638 | */ | 651 | */ |
639 | if (unlikely(!waiter.task)) | 652 | if (unlikely(!waiter.task)) { |
653 | /* | ||
654 | * Reset the return value. We might | ||
655 | * have returned with -EDEADLK and the | ||
656 | * owner released the lock while we | ||
657 | * were walking the pi chain. | ||
658 | */ | ||
659 | ret = 0; | ||
640 | continue; | 660 | continue; |
641 | 661 | } | |
642 | if (unlikely(ret)) | 662 | if (unlikely(ret)) |
643 | break; | 663 | break; |
644 | } | 664 | } |