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 | 6 +++--- include/linux/dcache.h | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff -puN fs/dcache.c~lock-validator-special-locking-dcache fs/dcache.c --- devel/fs/dcache.c~lock-validator-special-locking-dcache 2006-06-09 15:18:41.000000000 -0700 +++ devel-akpm/fs/dcache.c 2006-06-09 15:18:41.000000000 -0700 @@ -1380,10 +1380,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 */ @@ -1420,7 +1420,7 @@ already_unhashed: } list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); - spin_unlock(&target->d_lock); + spin_unlock_non_nested(&target->d_lock); fsnotify_d_move(dentry); spin_unlock(&dentry->d_lock); write_sequnlock(&rename_lock); diff -puN include/linux/dcache.h~lock-validator-special-locking-dcache include/linux/dcache.h --- devel/include/linux/dcache.h~lock-validator-special-locking-dcache 2006-06-09 15:18:41.000000000 -0700 +++ devel-akpm/include/linux/dcache.h 2006-06-09 15:18:41.000000000 -0700 @@ -114,6 +114,18 @@ struct dentry { unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ }; +/* + * dentry->d_lock spinlock nesting types: + * + * 0: normal + * 1: nested + */ +enum dentry_d_lock_type +{ + DENTRY_D_LOCK_NORMAL, + DENTRY_D_LOCK_NESTED +}; + struct dentry_operations { int (*d_revalidate)(struct dentry *, struct nameidata *); int (*d_hash) (struct dentry *, struct qstr *); _