summaryrefslogtreecommitdiff
path: root/kernel/lockdep.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2008-01-16 09:51:58 +0100
committerPeter Zijlstra <a.p.zijlstra@chello.nl>2008-01-16 09:51:58 +0100
commit5a26db5bd25cf4bf32ae9fa9f6136b6b6d5b45c5 (patch)
treee6c3c26bb9b45644aea3adb02f1747a336987e64 /kernel/lockdep.c
parentcbd9c883696da72b2b1f03f909dbacc04bbf8b58 (diff)
downloadkernel-common-5a26db5bd25cf4bf32ae9fa9f6136b6b6d5b45c5.tar.gz
kernel-common-5a26db5bd25cf4bf32ae9fa9f6136b6b6d5b45c5.tar.bz2
kernel-common-5a26db5bd25cf4bf32ae9fa9f6136b6b6d5b45c5.zip
lockdep: fix internal double unlock during self-test
Lockdep, during self-test (when it was simulating double unlocks) was sometimes unconditionally unlocking a spinlock when it had not been locked. This won't work for ticket locks. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r--kernel/lockdep.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 723bd9f92556..4335f12a27c6 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2943,9 +2943,10 @@ void lockdep_free_key_range(void *start, unsigned long size)
struct list_head *head;
unsigned long flags;
int i;
+ int locked;
raw_local_irq_save(flags);
- graph_lock();
+ locked = graph_lock();
/*
* Unhash all classes that were created by this module:
@@ -2959,7 +2960,8 @@ void lockdep_free_key_range(void *start, unsigned long size)
zap_class(class);
}
- graph_unlock();
+ if (locked)
+ graph_unlock();
raw_local_irq_restore(flags);
}
@@ -2969,6 +2971,7 @@ void lockdep_reset_lock(struct lockdep_map *lock)
struct list_head *head;
unsigned long flags;
int i, j;
+ int locked;
raw_local_irq_save(flags);
@@ -2987,7 +2990,7 @@ void lockdep_reset_lock(struct lockdep_map *lock)
* Debug check: in the end all mapped classes should
* be gone.
*/
- graph_lock();
+ locked = graph_lock();
for (i = 0; i < CLASSHASH_SIZE; i++) {
head = classhash_table + i;
if (list_empty(head))
@@ -3000,7 +3003,8 @@ void lockdep_reset_lock(struct lockdep_map *lock)
}
}
}
- graph_unlock();
+ if (locked)
+ graph_unlock();
out_restore:
raw_local_irq_restore(flags);