aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-02-07 17:17:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-02-07 17:17:18 -0500
commit34a9bff4abd4db833c3c338d2f942eafe927ca92 (patch)
tree64a9cbb37da13a4e736d24e4b54fbceca356af03 /fs
parent41f76d8bee06be5a9b301ebf13f61a719ba548c4 (diff)
parentda9846ae15186d491d6e21ebbb5051e1d3c7f652 (diff)
Merge tag 'driver-core-3.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core fix from Greg KH: "Here is a single kernfs fix to resolve a much-reported lockdep issue with the removal of entries in sysfs" * tag 'driver-core-3.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: kernfs: make kernfs_deactivate() honor KERNFS_LOCKDEP flag
Diffstat (limited to 'fs')
-rw-r--r--fs/kernfs/dir.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 5104cf5d25c5..bd6e18be6e1a 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -187,19 +187,23 @@ static void kernfs_deactivate(struct kernfs_node *kn)
187 187
188 kn->u.completion = (void *)&wait; 188 kn->u.completion = (void *)&wait;
189 189
190 rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_); 190 if (kn->flags & KERNFS_LOCKDEP)
191 rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_);
191 /* atomic_add_return() is a mb(), put_active() will always see 192 /* atomic_add_return() is a mb(), put_active() will always see
192 * the updated kn->u.completion. 193 * the updated kn->u.completion.
193 */ 194 */
194 v = atomic_add_return(KN_DEACTIVATED_BIAS, &kn->active); 195 v = atomic_add_return(KN_DEACTIVATED_BIAS, &kn->active);
195 196
196 if (v != KN_DEACTIVATED_BIAS) { 197 if (v != KN_DEACTIVATED_BIAS) {
197 lock_contended(&kn->dep_map, _RET_IP_); 198 if (kn->flags & KERNFS_LOCKDEP)
199 lock_contended(&kn->dep_map, _RET_IP_);
198 wait_for_completion(&wait); 200 wait_for_completion(&wait);
199 } 201 }
200 202
201 lock_acquired(&kn->dep_map, _RET_IP_); 203 if (kn->flags & KERNFS_LOCKDEP) {
202 rwsem_release(&kn->dep_map, 1, _RET_IP_); 204 lock_acquired(&kn->dep_map, _RET_IP_);
205 rwsem_release(&kn->dep_map, 1, _RET_IP_);
206 }
203} 207}
204 208
205/** 209/**