Unverified Commit 7b3b2702 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!4280 v2 fs:/dcache.c: fix negative dentry limit not complete problem

Merge Pull Request from: @ci-robot 
 
PR sync from: Long Li <leo.lilong@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/63F2VTC73UZDNLGJP2FA3JQ73K7N4E3U/ 
In this patch set, it revert "fs:/dcache.c: fix negative dentry limit not
complete problem" in patch 1/2 and rewrite this patch in patch 2/2.

Long Li (2):
  Revert "fs:/dcache.c: fix negative dentry limit not complete problem"
  fs:/dcache.c: fix negative dentry limit not complete problem


-- 
2.31.1
 
 
 
Link:https://gitee.com/openeuler/kernel/pulls/4280

 

Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 9bbedcdc e91cbe16
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -846,14 +846,25 @@ static inline bool fast_dput(struct dentry *dentry)

	/* Nothing to do? Dropping the reference was all we needed? */
	if (d_flags == (DCACHE_REFERENCED | DCACHE_LRU_LIST) && !d_unhashed(dentry)) {
		/*
		 * If the dentry is not negative dentry, return true directly,
		 * avoid holding dentry lock in the fast put path.
		 */
		if (dentry->d_inode)
			return true;
		/*
		 * If dentry is negative and need to be limitted, it maybe need
		 * to be killed, so shouldn't fast put and retain in memory.
		 */
		if (likely(!limit_negative_dentry(dentry)))
		spin_lock(&dentry->d_lock);
		if (likely(!limit_negative_dentry(dentry))) {
			spin_unlock(&dentry->d_lock);
			return true;
		}

		goto dentry_locked;
	}

	/*
	 * Not the fast normal case? Get the lock. We've already decremented
	 * the refcount, but we'll need to re-check the situation after
@@ -861,6 +872,7 @@ static inline bool fast_dput(struct dentry *dentry)
	 */
	spin_lock(&dentry->d_lock);

dentry_locked:
	/*
	 * Did somebody else grab a reference to it in the meantime, and
	 * we're no longer the last user after all? Alternatively, somebody