From 2a4205dd5d254f99df9124d0ffe722db4500280b Mon Sep 17 00:00:00 2001 From: Bruno Faccini Date: Fri, 1 Apr 2016 14:31:55 +0200 Subject: [PATCH] LU-7973 llite: lock i_lock/dcache_lock before __d_drop() There has been several Lustre Client crashes reported by sites running with Lustre versions 2.1/2.5, all showing the same dentry->d_hash->next corrupted pointer cause. This patch fixes a regression that has been introduced since a long time by commit : d10c9e05ab593f361fdfd27842766a1924e63e58 (LU-506 kernel: FC15 - support dcache scalability changes.) where i_lock/dcache_lock protection usage has been removed and that is likely to cause racy condition during dentry [un]hashing and to be the root cause of these crashes. Signed-off-by: Bruno Faccini Change-Id: Ie1239058222f15f7e094d8fae4d37e4a36449707 Reviewed-on: http://review.whamcloud.com/19287 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Yang Sheng Reviewed-by: Oleg Drokin --- lustre/llite/file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 2eb5b75..bbcbd29 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -3372,8 +3372,11 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits) do_lookup() -> ll_revalidate_it(). We cannot use d_drop here to preserve get_cwd functionality on 2.6. Bug 10503 */ - if (!dentry->d_inode->i_nlink) + if (!dentry->d_inode->i_nlink) { + ll_lock_dcache(inode); d_lustre_invalidate(dentry, 0); + ll_unlock_dcache(inode); + } ll_lookup_finish_locks(&oit, dentry); } else if (!ll_have_md_lock(dentry->d_inode, &ibits, LCK_MINMODE)) { -- 1.8.3.1