@@ -362,6 +362,10 @@ extern void lockdep_trace_alloc(gfp_t mask);
WARN_ON(debug_locks && !lockdep_is_held(l)); \
} while (0)
+#define lockdep_assert_not_held(l) do { \
+ WARN_ON(debug_locks && lockdep_is_held(l)); \
+ } while (0)
+
#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
#else /* !CONFIG_LOCKDEP */
@@ -413,6 +417,8 @@ struct lock_class_key { };
#define lockdep_assert_held(l) do { (void)(l); } while (0)
+#define lockdep_assert_not_held(l) do { (void)(l); } while (0)
+
#define lockdep_recursing(tsk) (0)
#endif /* !LOCKDEP */
We currently have the ability to call lockdep_assert_held to throw a warning when a spinlock isn't held in a codepath. There are also times when we'd like to throw a warning when a lock is held (i.e. when there is the potential for deadlock). Signed-off-by: Jeff Layton <jlayton@primarydata.com> --- include/linux/lockdep.h | 6 ++++++ 1 file changed, 6 insertions(+)