#From oleg@tv-sign.ru Mon Jan 7 18:30:05 2008 #Date: Mon, 7 Jan 2008 20:22:39 +0300 #From: Oleg Nesterov #To: Peter Zijlstra #Cc: Herbert Xu , Ingo Molnar , Rafael J. Wysocki , Christian Kujau , linux-kernel@vger.kernel.org, jfs-discussion@lists.sourceforge.net, Davide Libenzi , Johannes Berg #Subject: Re: 2.6.24-rc6: possible recursive locking detected # #On 01/05, Peter Zijlstra wrote: #> #> Since EP_MAX_POLLWAKE_NESTS < MAX_LOCKDEP_SUBCLASSES we could perhaps do #> something like: #> #> wake_up_nested(..., wake_nests); # #I think this would be the most correct change. But I wonder if it is possible #to do something more generic (but otoh more stupid/hackish and less safe). # #Consider this "just for illustration" patch, # --- t/kernel/lockdep.c 2007-11-09 12:57:31.000000000 +0300 +++ t/kernel/lockdep.c 2008-01-07 19:43:50.000000000 +0300 @@ -1266,10 +1266,13 @@ check_deadlock(struct task_struct *curr, struct held_lock *prev; int i; - for (i = 0; i < curr->lockdep_depth; i++) { + for (i = curr->lockdep_depth; --i >= 0; ) { prev = curr->held_locks + i; if (prev->class != next->class) continue; + + if (prev->trylock == -1) + return 2; /* * Allow read-after-read recursion of the same * lock class (i.e. read_lock(lock)+read_lock(lock)):