All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@primarydata.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 7/9] NFS: Fix and clean up the access cache validity checking
Date: Sat, 17 Dec 2016 13:27:09 -0500	[thread overview]
Message-ID: <20161217182711.10643-8-trond.myklebust@primarydata.com> (raw)
In-Reply-To: <20161217182711.10643-7-trond.myklebust@primarydata.com>

The access cache needs to check whether or not the mode bits, ownership,
or ACL has changed or the cache has timed out.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/dir.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 8f706f3e5c05..fad81041f5ab 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2286,8 +2286,7 @@ static int nfs_access_get_cached(struct inode *inode, struct rpc_cred *cred, str
 		if (cache == NULL)
 			goto out;
 		/* Found an entry, is our attribute cache valid? */
-		if (!nfs_attribute_cache_expired(inode) &&
-		    !(nfsi->cache_validity & NFS_INO_INVALID_ATTR))
+		if (!nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS))
 			break;
 		err = -ECHILD;
 		if (!may_block)
@@ -2335,12 +2334,12 @@ static int nfs_access_get_cached_rcu(struct inode *inode, struct rpc_cred *cred,
 		cache = NULL;
 	if (cache == NULL)
 		goto out;
-	err = nfs_revalidate_inode_rcu(NFS_SERVER(inode), inode);
-	if (err)
+	if (nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS))
 		goto out;
 	res->jiffies = cache->jiffies;
 	res->cred = cache->cred;
 	res->mask = cache->mask;
+	err = 0;
 out:
 	rcu_read_unlock();
 	return err;
@@ -2492,12 +2491,13 @@ EXPORT_SYMBOL_GPL(nfs_may_open);
 static int nfs_execute_ok(struct inode *inode, int mask)
 {
 	struct nfs_server *server = NFS_SERVER(inode);
-	int ret;
+	int ret = 0;
 
-	if (mask & MAY_NOT_BLOCK)
-		ret = nfs_revalidate_inode_rcu(server, inode);
-	else
-		ret = nfs_revalidate_inode(server, inode);
+	if (nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS)) {
+		if (mask & MAY_NOT_BLOCK)
+			return -ECHILD;
+		ret = __nfs_revalidate_inode(server, inode);
+	}
 	if (ret == 0 && !execute_ok(inode))
 		ret = -EACCES;
 	return ret;
-- 
2.9.3


  reply	other threads:[~2016-12-17 18:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-17 18:27 [PATCH 0/9] NFS client attribute cache performance improvements Trond Myklebust
2016-12-17 18:27 ` [PATCH 1/9] NFSv4: Don't invalidate the directory twice Trond Myklebust
2016-12-17 18:27   ` [PATCH 2/9] NFSv4: Update the attribute cache info in update_changeattr Trond Myklebust
2016-12-17 18:27     ` [PATCH 3/9] NFSv4: Don't discard the attributes returned by asynchronous DELEGRETURN Trond Myklebust
2016-12-17 18:27       ` [PATCH 4/9] NFS: Don't revalidate the file on close if we hold a delegation Trond Myklebust
2016-12-17 18:27         ` [PATCH 5/9] NFS: Clean up cache validity checking Trond Myklebust
2016-12-17 18:27           ` [PATCH 6/9] NFS: Only look at the change attribute cache state in nfs_weak_revalidate() Trond Myklebust
2016-12-17 18:27             ` Trond Myklebust [this message]
2016-12-17 18:27               ` [PATCH 8/9] NFS: Remove unused function nfs_revalidate_inode_rcu() Trond Myklebust
2016-12-17 18:27                 ` [PATCH 9/9] NFS: Clean up nfs_attribute_timeout() Trond Myklebust
2016-12-19 16:54   ` [PATCH 1/9] NFSv4: Don't invalidate the directory twice Anna Schumaker
2016-12-19 16:56     ` Trond Myklebust
2016-12-19 17:00       ` Trond Myklebust
2016-12-19 17:07       ` Anna Schumaker
2016-12-19 17:30         ` Trond Myklebust
2016-12-19 19:05           ` Anna Schumaker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161217182711.10643-8-trond.myklebust@primarydata.com \
    --to=trond.myklebust@primarydata.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.