[PATCH] lockdep: lockdep_depth vs. debug_locks
authorJarek Poplawski <jarkao2@o2.pl>
Thu, 22 Mar 2007 08:11:26 +0000 (00:11 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 23 Mar 2007 02:39:06 +0000 (19:39 -0700)
lockdep found a bug during a run of workqueue function - this could be also
caused by a bug from other code running simultaneously.

lockdep really shouldn't be used when debug_locks == 0!

Reported-by: Folkert van Heusden <folkert@vanheusden.com>
Inspired-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Jarek Poplawski <jarkao2@o2.pl>
Cc: Ingo Molnar <mingo@elte.hu>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/lockdep.h

index 06fe93a3e916d882fa09fe4275ed9cbf922ac8c0..14c937d345cb135916fff7a44878a631b9ae3813 100644 (file)
@@ -245,7 +245,7 @@ extern void lock_release(struct lockdep_map *lock, int nested,
 
 # define INIT_LOCKDEP                          .lockdep_recursion = 0,
 
-#define lockdep_depth(tsk)     ((tsk)->lockdep_depth)
+#define lockdep_depth(tsk)     (debug_locks ? (tsk)->lockdep_depth : 0)
 
 #else /* !LOCKDEP */