From: Ingo Molnar Teach special (recursive) locking code to the lock validator. Has no effect on non-lockdep kernels. Signed-off-by: Ingo Molnar Signed-off-by: Arjan van de Ven Signed-off-by: Andrew Morton --- fs/dcache.c | 4 ++-- include/linux/dcache.h | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff -puN fs/dcache.c~lockdep-annotate-dcache fs/dcache.c --- a/fs/dcache.c~lockdep-annotate-dcache +++ a/fs/dcache.c @@ -1340,10 +1340,10 @@ void d_move(struct dentry * dentry, stru */ if (target < dentry) { spin_lock(&target->d_lock); - spin_lock(&dentry->d_lock); + spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); } else { spin_lock(&dentry->d_lock); - spin_lock(&target->d_lock); + spin_lock_nested(&target->d_lock, DENTRY_D_LOCK_NESTED); } /* Move the dentry to the target hash queue, if on different bucket */ diff -puN include/linux/dcache.h~lockdep-annotate-dcache include/linux/dcache.h --- a/include/linux/dcache.h~lockdep-annotate-dcache +++ a/include/linux/dcache.h @@ -114,6 +114,18 @@ struct dentry { unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ }; +/* + * dentry->d_lock spinlock nesting subclasses: + * + * 0: normal + * 1: nested + */ +enum dentry_d_lock_class +{ + DENTRY_D_LOCK_NORMAL, /* implicitly used by plain spin_lock() APIs. */ + DENTRY_D_LOCK_NESTED +}; + struct dentry_operations { int (*d_revalidate)(struct dentry *, struct nameidata *); int (*d_hash) (struct dentry *, struct qstr *); _