diff options
| author | Vegard Nossum <vegard.nossum@gmail.com> | 2008-08-31 17:39:21 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2008-09-01 03:47:16 -0400 |
| commit | 673d62cc5ea6fca046650f17f77985b112c62322 (patch) | |
| tree | 7cde0d756ffa71ad732cc079d28254b256c14e68 /include | |
| parent | bef69ea0dcce574a425feb0a5aa4c63dd108b9a6 (diff) | |
debugobjects: fix lockdep warning
Daniel J. Blueman reported:
> =======================================================
> [ INFO: possible circular locking dependency detected ]
> 2.6.27-rc4-224c #1
> -------------------------------------------------------
> hald/4680 is trying to acquire lock:
> (&n->list_lock){++..}, at: [<ffffffff802bfa26>] add_partial+0x26/0x80
>
> but task is already holding lock:
> (&obj_hash[i].lock){++..}, at: [<ffffffff8041cfdc>]
> debug_object_free+0x5c/0x120
We fix it by moving the actual freeing to outside the lock (the lock
now only protects the list).
The pool lock is also promoted to irq-safe (suggested by Dan). It's
necessary because free_pool is now called outside the irq disabled
region. So we need to protect against an interrupt handler which calls
debug_object_init().
[tglx@linutronix.de: added hlist_move_list helper to avoid looping
through the list twice]
Reported-by: Daniel J Blueman <daniel.blueman@gmail.com>
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/list.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index db35ef02e745..969f6e92d089 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
| @@ -619,6 +619,19 @@ static inline void hlist_add_after(struct hlist_node *n, | |||
| 619 | next->next->pprev = &next->next; | 619 | next->next->pprev = &next->next; |
| 620 | } | 620 | } |
| 621 | 621 | ||
| 622 | /* | ||
| 623 | * Move a list from one list head to another. Fixup the pprev | ||
| 624 | * reference of the first entry if it exists. | ||
| 625 | */ | ||
| 626 | static inline void hlist_move_list(struct hlist_head *old, | ||
| 627 | struct hlist_head *new) | ||
| 628 | { | ||
| 629 | new->first = old->first; | ||
| 630 | if (new->first) | ||
| 631 | new->first->pprev = &new->first; | ||
| 632 | old->first = NULL; | ||
| 633 | } | ||
| 634 | |||
| 622 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member) | 635 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member) |
| 623 | 636 | ||
| 624 | #define hlist_for_each(pos, head) \ | 637 | #define hlist_for_each(pos, head) \ |
