From ffde7a4902d24e9c9b9e77d1bbafba16ae7fb863 Mon Sep 17 00:00:00 2001 From: Paul Walmsley Date: Sun, 31 Mar 2013 00:04:40 +0000 Subject: [PATCH] --- yaml --- r: 361969 b: refs/heads/master c: dbf520a9d7d4d5ba28d2947be11e34099a5e3e20 h: refs/heads/master i: 361967: 94dba142c903f0e2936b691b203a042f0b767a38 v: v3 --- [refs] | 2 +- trunk/include/linux/debug_locks.h | 4 ++-- trunk/include/linux/freezer.h | 3 --- trunk/kernel/exit.c | 2 +- trunk/kernel/lockdep.c | 17 +++++++++-------- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index 9ee669eda18f..b786d970473b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 13d2080db3472b3399ba32e6026960de5d32a344 +refs/heads/master: dbf520a9d7d4d5ba28d2947be11e34099a5e3e20 diff --git a/trunk/include/linux/debug_locks.h b/trunk/include/linux/debug_locks.h index a975de1ff59f..3bd46f766751 100644 --- a/trunk/include/linux/debug_locks.h +++ b/trunk/include/linux/debug_locks.h @@ -51,7 +51,7 @@ struct task_struct; extern void debug_show_all_locks(void); extern void debug_show_held_locks(struct task_struct *task); extern void debug_check_no_locks_freed(const void *from, unsigned long len); -extern void debug_check_no_locks_held(void); +extern void debug_check_no_locks_held(struct task_struct *task); #else static inline void debug_show_all_locks(void) { @@ -67,7 +67,7 @@ debug_check_no_locks_freed(const void *from, unsigned long len) } static inline void -debug_check_no_locks_held(void) +debug_check_no_locks_held(struct task_struct *task) { } #endif diff --git a/trunk/include/linux/freezer.h b/trunk/include/linux/freezer.h index 043a5cf8b5ba..e70df40d84f6 100644 --- a/trunk/include/linux/freezer.h +++ b/trunk/include/linux/freezer.h @@ -3,7 +3,6 @@ #ifndef FREEZER_H_INCLUDED #define FREEZER_H_INCLUDED -#include #include #include #include @@ -49,8 +48,6 @@ extern void thaw_kernel_threads(void); static inline bool try_to_freeze(void) { - if (!(current->flags & PF_NOFREEZE)) - debug_check_no_locks_held(); might_sleep(); if (likely(!freezing(current))) return false; diff --git a/trunk/kernel/exit.c b/trunk/kernel/exit.c index 51e485ca9935..60bc027c61c3 100644 --- a/trunk/kernel/exit.c +++ b/trunk/kernel/exit.c @@ -835,7 +835,7 @@ void do_exit(long code) /* * Make sure we are holding no locks: */ - debug_check_no_locks_held(); + debug_check_no_locks_held(tsk); /* * We can do this unlocked here. The futex code uses this flag * just to verify whether the pi state cleanup has been done diff --git a/trunk/kernel/lockdep.c b/trunk/kernel/lockdep.c index 259db207b5d9..8a0efac4f99d 100644 --- a/trunk/kernel/lockdep.c +++ b/trunk/kernel/lockdep.c @@ -4088,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(void) +static void print_held_locks_bug(struct task_struct *curr) { if (!debug_locks_off()) return; @@ -4097,21 +4097,22 @@ static void print_held_locks_bug(void) printk("\n"); printk("=====================================\n"); - printk("[ BUG: %s/%d still has locks held! ]\n", - current->comm, task_pid_nr(current)); + printk("[ BUG: lock held at task exit time! ]\n"); print_kernel_ident(); printk("-------------------------------------\n"); - lockdep_print_held_locks(current); + printk("%s/%d is exiting with locks still held!\n", + curr->comm, task_pid_nr(curr)); + lockdep_print_held_locks(curr); + printk("\nstack backtrace:\n"); dump_stack(); } -void debug_check_no_locks_held(void) +void debug_check_no_locks_held(struct task_struct *task) { - if (unlikely(current->lockdep_depth > 0)) - print_held_locks_bug(); + if (unlikely(task->lockdep_depth > 0)) + print_held_locks_bug(task); } -EXPORT_SYMBOL_GPL(debug_check_no_locks_held); void debug_show_all_locks(void) {