[PATCH] lockdep: lockdep_depth vs. debug_locks Re: [2.6.20] BUG: workqueue leaked lock

Jarek Poplawski
2007-03-22T06:07:08Z

Here is some joke:

[PATCH] lockdep: lockdep_depth vs. debug_locks

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>

---

diff -Nurp 2.6.21-rc4-git4-/include/linux/lockdep.h 2.6.21-rc4-git4/include/linux/lockdep.h
--- 2.6.21-rc4-git4-/include/linux/lockdep.h 2007-03-20 20:24:17.000000000 +0100
+++ 2.6.21-rc4-git4/include/linux/lockdep.h 2007-03-21 22:32:41.000000000 +0100
@@ -245,7 +245,7 @@ extern void lock_release(struct lockdep_

# 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 */