Skip to content

Commit 34a9bff

Browse files
committed
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
2 parents 41f76d8 + da9846a commit 34a9bff

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

fs/kernfs/dir.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,19 +187,23 @@ static void kernfs_deactivate(struct kernfs_node *kn)
187187

188188
kn->u.completion = (void *)&wait;
189189

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_);
191192
/* atomic_add_return() is a mb(), put_active() will always see
192193
* the updated kn->u.completion.
193194
*/
194195
v = atomic_add_return(KN_DEACTIVATED_BIAS, &kn->active);
195196

196197
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_);
198200
wait_for_completion(&wait);
199201
}
200202

201-
lock_acquired(&kn->dep_map, _RET_IP_);
202-
rwsem_release(&kn->dep_map, 1, _RET_IP_);
203+
if (kn->flags & KERNFS_LOCKDEP) {
204+
lock_acquired(&kn->dep_map, _RET_IP_);
205+
rwsem_release(&kn->dep_map, 1, _RET_IP_);
206+
}
203207
}
204208

205209
/**

0 commit comments

Comments
 (0)