]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: use new mutex_owned(), not mutex_is_locked()
authorKris Van Hees <kris.van.hees@oracle.com>
Tue, 7 Feb 2012 09:31:48 +0000 (04:31 -0500)
committerNick Alcock <nick.alcock@oracle.com>
Mon, 29 Jun 2015 21:40:24 +0000 (22:40 +0100)
This is used in our implementation of the Solaris MUTEX_HELD() macro.
The former was merely testing whether the mutex was locked, whereas
the real test needed here is whether the mutex is held by the current thread.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
include/linux/mutex.h

index 2cb7531e7d7a6f5044e56abc6dc3cc80cac4e596..0df7f84bc282c448e1bbfb5f9bee84016ae8df42 100644 (file)
@@ -175,4 +175,16 @@ extern void mutex_unlock(struct mutex *lock);
 
 extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
 
+#ifdef CONFIG_SMP
+static inline int mutex_owned(struct mutex *lock)
+{
+       return lock->owner == current;
+}
+#else
+static inline int mutex_owned(struct mutex *lock)
+{
+       return mutex_is_locked(lock);
+}
+#endif
+
 #endif /* __LINUX_MUTEX_H */