Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359292
b: refs/heads/master
c: 6aa9707
h: refs/heads/master
v: v3
  • Loading branch information
Mandeep Singh Baines authored and Linus Torvalds committed Feb 28, 2013
1 parent a72f3f0 commit 553f71e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c2c1b089b44b783bd50fae4bccaa6f367f92e492
refs/heads/master: 6aa9707099c4b25700940eb3d016f16c4434360d
4 changes: 2 additions & 2 deletions trunk/include/linux/debug_locks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(struct task_struct *task);
extern void debug_check_no_locks_held(void);
#else
static inline void debug_show_all_locks(void)
{
Expand All @@ -67,7 +67,7 @@ debug_check_no_locks_freed(const void *from, unsigned long len)
}

static inline void
debug_check_no_locks_held(struct task_struct *task)
debug_check_no_locks_held(void)
{
}
#endif
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/freezer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#ifndef FREEZER_H_INCLUDED
#define FREEZER_H_INCLUDED

#include <linux/debug_locks.h>
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/atomic.h>
Expand Down Expand Up @@ -48,6 +49,8 @@ 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;
Expand Down
2 changes: 1 addition & 1 deletion trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ void do_exit(long code)
/*
* Make sure we are holding no locks:
*/
debug_check_no_locks_held(tsk);
debug_check_no_locks_held();
/*
* We can do this unlocked here. The futex code uses this flag
* just to verify whether the pi state cleanup has been done
Expand Down
17 changes: 8 additions & 9 deletions trunk/kernel/lockdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(struct task_struct *curr)
static void print_held_locks_bug(void)
{
if (!debug_locks_off())
return;
Expand All @@ -4097,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)
{
Expand Down

0 comments on commit 553f71e

Please sign in to comment.