Skip to content

Commit

Permalink
Merge tag 'driver-core-3.14-rc2' of git://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/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
  • Loading branch information
Linus Torvalds committed Feb 7, 2014
2 parents 41f76d8 + da9846a commit 34a9bff
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions fs/kernfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
}
}

/**
Expand Down

0 comments on commit 34a9bff

Please sign in to comment.