diff --git a/fs/dcache.c b/fs/dcache.c index 2a7eaac0c3ef9601b0eb36c9ea0dee927f387d66..532fc8d1e7a08a0c2ef8489aaa6de8f130163cba 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -828,7 +828,10 @@ static inline bool fast_dput(struct dentry *dentry) * to be killed, so shouldn't fast put and retain in memory. */ spin_lock(&dentry->d_lock); - if (likely(!limit_negative_dentry(dentry))) { + d_flags = dentry->d_flags & (DCACHE_REFERENCED | DCACHE_LRU_LIST); + if ((d_flags != (DCACHE_REFERENCED | DCACHE_LRU_LIST)) || + d_unhashed(dentry) || + likely(!limit_negative_dentry(dentry))) { spin_unlock(&dentry->d_lock); return true; }