From c4688c988a0f865c1c9f2b72851bf199158b89e0 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 28 May 2013 15:18:52 +0800 Subject: [PATCH] LU-3409 llite: silence lockdep warning in ll_md_blocking_ast Got bellow lockdep warning during tests. It is false alarm though. [ 1184.479097] ============================================= [ 1184.479187] [ INFO: possible recursive locking detected ] [ 1184.479277] 3.10.0-rc3+ #13 Tainted: G C [ 1184.479355] --------------------------------------------- [ 1184.479444] mkdir/2215 is trying to acquire lock: [ 1184.479521] (&(&dentry->d_lock)->rlock){+.+...}, at: [] ll_md_blocking_ast+0x55c/0x655 [lustre] [ 1184.479801] but task is already holding lock: [ 1184.479895] (&(&dentry->d_lock)->rlock){+.+...}, at: [] ll_md_blocking_ast+0x491/0x655 [lustre] [ 1184.480101] other info that might help us debug this: [ 1184.480206] Possible unsafe locking scenario: [ 1184.480300] CPU0 [ 1184.480340] ---- [ 1184.480380] lock(&(&dentry->d_lock)->rlock); [ 1184.480458] lock(&(&dentry->d_lock)->rlock); [ 1184.480536] *** DEADLOCK *** [ 1184.480761] May be due to missing lock nesting notation Signed-off-by: Peng Tao Change-Id: I34c54ddc7a36dbef77564b1e4f14a16d848b2eaa Reviewed-on: http://review.whamcloud.com/6469 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Keith Mannthey Reviewed-by: Lai Siyao --- lustre/llite/dcache.c | 2 +- lustre/llite/file.c | 2 +- lustre/llite/llite_internal.h | 5 +++-- lustre/llite/namei.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 328a687..029e621 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -329,7 +329,7 @@ void ll_invalidate_aliases(struct inode *inode) libcfs_debug_dumpstack(NULL); } - d_lustre_invalidate(dentry); + d_lustre_invalidate(dentry, 0); } ll_unlock_dcache(inode); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 94f7784..a216652 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -2779,7 +2779,7 @@ int __ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it, here to preserve get_cwd functionality on 2.6. Bug 10503 */ if (!dentry->d_inode->i_nlink) - d_lustre_invalidate(dentry); + d_lustre_invalidate(dentry, 0); ll_lookup_finish_locks(&oit, dentry); } else if (!ll_have_md_lock(dentry->d_inode, &ibits, LCK_MINMODE)) { diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index d150bb6..daaa371 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -1585,13 +1585,14 @@ static inline void __d_lustre_invalidate(struct dentry *dentry) * ll_md_blocking_ast), unhash this dentry, and let dcache to reclaim it later; * else dput() of the last refcount will unhash this dentry and kill it. */ -static inline void d_lustre_invalidate(struct dentry *dentry) +static inline void d_lustre_invalidate(struct dentry *dentry, int nested) { CDEBUG(D_DENTRY, "invalidate dentry %.*s (%p) parent %p inode %p " "refc %d\n", dentry->d_name.len, dentry->d_name.name, dentry, dentry->d_parent, dentry->d_inode, d_refcount(dentry)); - spin_lock(&dentry->d_lock); + spin_lock_nested(&dentry->d_lock, + nested ? DENTRY_D_LOCK_NESTED : DENTRY_D_LOCK_NORMAL); __d_lustre_invalidate(dentry); if (d_refcount(dentry) == 0) __d_drop(dentry); diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index a14c86c..7383c7c 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -187,7 +187,7 @@ static void ll_invalidate_negative_children(struct inode *dir) &dentry->d_subdirs, d_u.d_child) { if (child->d_inode == NULL) - d_lustre_invalidate(child); + d_lustre_invalidate(child, 1); } } spin_unlock(&dentry->d_lock); -- 1.8.3.1