]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - kernel/lockdep.c
Merge tag 'md-3.9' of git://neil.brown.name/md
[karo-tx-linux.git] / kernel / lockdep.c
index 7981e5b2350dd64835608d955d11146c94511170..259db207b5d90806536da88963e7d1b469e1b943 100644 (file)
@@ -3190,9 +3190,14 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
 #endif
        if (unlikely(curr->lockdep_depth >= MAX_LOCK_DEPTH)) {
                debug_locks_off();
-               printk("BUG: MAX_LOCK_DEPTH too low!\n");
+               printk("BUG: MAX_LOCK_DEPTH too low, depth: %i  max: %lu!\n",
+                      curr->lockdep_depth, MAX_LOCK_DEPTH);
                printk("turning off the locking correctness validator.\n");
+
+               lockdep_print_held_locks(current);
+               debug_show_all_locks();
                dump_stack();
+
                return 0;
        }
 
@@ -3203,7 +3208,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
 }
 
 static int
-print_unlock_inbalance_bug(struct task_struct *curr, struct lockdep_map *lock,
+print_unlock_imbalance_bug(struct task_struct *curr, struct lockdep_map *lock,
                           unsigned long ip)
 {
        if (!debug_locks_off())
@@ -3246,7 +3251,7 @@ static int check_unlock(struct task_struct *curr, struct lockdep_map *lock,
                return 0;
 
        if (curr->lockdep_depth <= 0)
-               return print_unlock_inbalance_bug(curr, lock, ip);
+               return print_unlock_imbalance_bug(curr, lock, ip);
 
        return 1;
 }
@@ -3317,7 +3322,7 @@ __lock_set_class(struct lockdep_map *lock, const char *name,
                        goto found_it;
                prev_hlock = hlock;
        }
-       return print_unlock_inbalance_bug(curr, lock, ip);
+       return print_unlock_imbalance_bug(curr, lock, ip);
 
 found_it:
        lockdep_init_map(lock, name, key, 0);
@@ -3384,7 +3389,7 @@ lock_release_non_nested(struct task_struct *curr,
                        goto found_it;
                prev_hlock = hlock;
        }
-       return print_unlock_inbalance_bug(curr, lock, ip);
+       return print_unlock_imbalance_bug(curr, lock, ip);
 
 found_it:
        if (hlock->instance == lock)
@@ -4083,7 +4088,7 @@ void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len)
 }
 EXPORT_SYMBOL_GPL(debug_check_no_locks_freed);
 
-static void print_held_locks_bug(struct task_struct *curr)
+static void print_held_locks_bug(void)
 {
        if (!debug_locks_off())
                return;
@@ -4092,22 +4097,21 @@ static void print_held_locks_bug(struct task_struct *curr)
 
        printk("\n");
        printk("=====================================\n");
-       printk("[ BUG: lock held at task exit time! ]\n");
+       printk("[ BUG: %s/%d still has locks held! ]\n",
+              current->comm, task_pid_nr(current));
        print_kernel_ident();
        printk("-------------------------------------\n");
-       printk("%s/%d is exiting with locks still held!\n",
-               curr->comm, task_pid_nr(curr));
-       lockdep_print_held_locks(curr);
-
+       lockdep_print_held_locks(current);
        printk("\nstack backtrace:\n");
        dump_stack();
 }
 
-void debug_check_no_locks_held(struct task_struct *task)
+void debug_check_no_locks_held(void)
 {
-       if (unlikely(task->lockdep_depth > 0))
-               print_held_locks_bug(task);
+       if (unlikely(current->lockdep_depth > 0))
+               print_held_locks_bug();
 }
+EXPORT_SYMBOL_GPL(debug_check_no_locks_held);
 
 void debug_show_all_locks(void)
 {