From: Trond Myklebust <trondmy@gmail.com>
Date: Mon, 6 Jan 2020 20:39:36 +0000 (-0500)
Subject: NFS: Trust cached access if we've already revalidated the inode once
X-Git-Tag: baikal/mips/sdk5.9~14322^2~26
X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=f3ad7c3236556e80b756288f44306b13e9e50258;p=kernel.git

NFS: Trust cached access if we've already revalidated the inode once

If we've already revalidated the inode once then don't distrust the
access cache unless the NFS_INO_INVALID_ACCESS flag is actually set.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 372c16b3042c3..9405eeadc3f38 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2312,11 +2312,11 @@ static int nfs_access_get_cached(struct inode *inode, const struct cred *cred, s
 		/* Found an entry, is our attribute cache valid? */
 		if (!nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS))
 			break;
+		if (!retry)
+			break;
 		err = -ECHILD;
 		if (!may_block)
 			goto out;
-		if (!retry)
-			goto out_zap;
 		spin_unlock(&inode->i_lock);
 		err = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
 		if (err)