diff options
| -rw-r--r-- | fs/kernfs/dir.c | 12 |
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 | /** |
