Driver core fix for 3.14-rc2

Here is a single kernfs fix to resolve a much-reported lockdep issue with the
 removal of entries in sysfs.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iEYEABECAAYFAlL1WqIACgkQMUfUDdst+ykauACeMlmM0Ro0nCjU5e9Dq9qFw0ZJ
 u2oAn3qxgNIRKIjZTxDfXmXgFr0sTfTW
 =UyO3
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2014-02-07 14:17:18 -08:00
commit 34a9bff4ab

View File

@ -187,19 +187,23 @@ static void kernfs_deactivate(struct kernfs_node *kn)
kn->u.completion = (void *)&wait;
rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_);
if (kn->flags & KERNFS_LOCKDEP)
rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_);
/* atomic_add_return() is a mb(), put_active() will always see
* the updated kn->u.completion.
*/
v = atomic_add_return(KN_DEACTIVATED_BIAS, &kn->active);
if (v != KN_DEACTIVATED_BIAS) {
lock_contended(&kn->dep_map, _RET_IP_);
if (kn->flags & KERNFS_LOCKDEP)
lock_contended(&kn->dep_map, _RET_IP_);
wait_for_completion(&wait);
}
lock_acquired(&kn->dep_map, _RET_IP_);
rwsem_release(&kn->dep_map, 1, _RET_IP_);
if (kn->flags & KERNFS_LOCKDEP) {
lock_acquired(&kn->dep_map, _RET_IP_);
rwsem_release(&kn->dep_map, 1, _RET_IP_);
}
}
/**