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 <bobijam@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/1434
Tested-by: Hudson
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
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);