|
@@ -1441,10 +1441,17 @@ EXPORT_SYMBOL_GPL(rt_mutex_timed_lock);
|
|
|
*
|
|
|
* @lock: the rt_mutex to be locked
|
|
|
*
|
|
|
+ * This function can only be called in thread context. It's safe to
|
|
|
+ * call it from atomic regions, but not from hard interrupt or soft
|
|
|
+ * interrupt context.
|
|
|
+ *
|
|
|
* Returns 1 on success and 0 on contention
|
|
|
*/
|
|
|
int __sched rt_mutex_trylock(struct rt_mutex *lock)
|
|
|
{
|
|
|
+ if (WARN_ON(in_irq() || in_nmi() || in_serving_softirq()))
|
|
|
+ return 0;
|
|
|
+
|
|
|
return rt_mutex_fasttrylock(lock, rt_mutex_slowtrylock);
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(rt_mutex_trylock);
|