Commit a90b9c05df3c1e58eaedc28795d0f5abd896c098
Committed by
Linus Torvalds
1 parent
13e83599d2
Exists in
master
and in
4 other branches
[PATCH] lockdep: annotate dcache
Teach special (recursive) locking code to the lock validator. Has no effect on non-lockdep kernels. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 2 changed files with 14 additions and 2 deletions Side-by-side Diff
fs/dcache.c
| ... | ... | @@ -1339,10 +1339,10 @@ |
| 1339 | 1339 | */ |
| 1340 | 1340 | if (target < dentry) { |
| 1341 | 1341 | spin_lock(&target->d_lock); |
| 1342 | - spin_lock(&dentry->d_lock); | |
| 1342 | + spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); | |
| 1343 | 1343 | } else { |
| 1344 | 1344 | spin_lock(&dentry->d_lock); |
| 1345 | - spin_lock(&target->d_lock); | |
| 1345 | + spin_lock_nested(&target->d_lock, DENTRY_D_LOCK_NESTED); | |
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | 1348 | /* Move the dentry to the target hash queue, if on different bucket */ |
include/linux/dcache.h
| ... | ... | @@ -114,6 +114,18 @@ |
| 114 | 114 | unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ |
| 115 | 115 | }; |
| 116 | 116 | |
| 117 | +/* | |
| 118 | + * dentry->d_lock spinlock nesting subclasses: | |
| 119 | + * | |
| 120 | + * 0: normal | |
| 121 | + * 1: nested | |
| 122 | + */ | |
| 123 | +enum dentry_d_lock_class | |
| 124 | +{ | |
| 125 | + DENTRY_D_LOCK_NORMAL, /* implicitly used by plain spin_lock() APIs. */ | |
| 126 | + DENTRY_D_LOCK_NESTED | |
| 127 | +}; | |
| 128 | + | |
| 117 | 129 | struct dentry_operations { |
| 118 | 130 | int (*d_revalidate)(struct dentry *, struct nameidata *); |
| 119 | 131 | int (*d_hash) (struct dentry *, struct qstr *); |