diff options
author | Jonathan Corbet <corbet@lwn.net> | 2010-09-08 18:54:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-09-09 12:09:43 -0400 |
commit | a73f8844e1fc54c3762555c1cf1f71774142ca91 (patch) | |
tree | 6cf860dead41a30f5fac677f0cd478efad564c8f /include | |
parent | 39aa3cb3e8250db9188a6f1e3fb62ffa1a717678 (diff) |
lglock: make lg_lock_global() actually lock globally
lg_lock_global() currently only acquires spinlocks for online CPUs, but
it's meant to lock all possible CPUs. Lglock-protected resources may be
associated with removed CPUs - and, indeed, that could happen with the
per-superblock open files lists.
At Nick's suggestion, change for_each_online_cpu() to
for_each_possible_cpu() to protect accesses to those resources.
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Acked-by: Nick Piggin <npiggin@kernel.dk>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/lglock.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/lglock.h b/include/linux/lglock.h index b288cb713b90..f549056fb20b 100644 --- a/include/linux/lglock.h +++ b/include/linux/lglock.h | |||
@@ -150,7 +150,7 @@ | |||
150 | int i; \ | 150 | int i; \ |
151 | preempt_disable(); \ | 151 | preempt_disable(); \ |
152 | rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ | 152 | rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ |
153 | for_each_online_cpu(i) { \ | 153 | for_each_possible_cpu(i) { \ |
154 | arch_spinlock_t *lock; \ | 154 | arch_spinlock_t *lock; \ |
155 | lock = &per_cpu(name##_lock, i); \ | 155 | lock = &per_cpu(name##_lock, i); \ |
156 | arch_spin_lock(lock); \ | 156 | arch_spin_lock(lock); \ |
@@ -161,7 +161,7 @@ | |||
161 | void name##_global_unlock(void) { \ | 161 | void name##_global_unlock(void) { \ |
162 | int i; \ | 162 | int i; \ |
163 | rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ | 163 | rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ |
164 | for_each_online_cpu(i) { \ | 164 | for_each_possible_cpu(i) { \ |
165 | arch_spinlock_t *lock; \ | 165 | arch_spinlock_t *lock; \ |
166 | lock = &per_cpu(name##_lock, i); \ | 166 | lock = &per_cpu(name##_lock, i); \ |
167 | arch_spin_unlock(lock); \ | 167 | arch_spin_unlock(lock); \ |