From: Bobi Jam Date: Wed, 23 Nov 2011 23:19:41 +0000 (+0800) Subject: LU-645 llite: Avoid unnecessary dentry rehashing X-Git-Tag: 2.1.53~29 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=b2d0facce07e734e4aa14653d0ef637dc553cb4a LU-645 llite: Avoid unnecessary dentry rehashing In patchless case the sequence __d_drop() then d_rehash_cond() creates race window if dentry is already hashed, in this case rehashing should be avoided. Change-Id: I59e035c6d19b869955e66fb010c1b137d0aab0ec Signed-off-by: Bobi Jam Reviewed-on: http://review.whamcloud.com/1434 Tested-by: Hudson Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index a7b314b..7b89ca9 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -1361,10 +1361,8 @@ static inline void ll_dentry_rehash(struct dentry *dentry, int locked) cfs_spin_lock(&ll_lookup_lock); spin_lock(&dcache_lock); } - lock_dentry(dentry); - __d_drop(dentry); - unlock_dentry(dentry); - d_rehash_cond(dentry, 0); + if (d_unhashed(dentry)) + d_rehash_cond(dentry, 0); if (!locked) { spin_unlock(&dcache_lock); cfs_spin_unlock(&ll_lookup_lock);