All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank van der Linden <fllinden@amazon.com>
To: <linux-nfs@vger.kernel.org>, <anna.schumaker@netapp.com>,
	<trond.myklebust@hammerspace.com>
Cc: Frank van der Linden <fllinden@amazon.com>
Subject: [PATCH v3 06/13] nfs: define nfs_access_get_cached function
Date: Tue, 23 Jun 2020 22:38:57 +0000	[thread overview]
Message-ID: <20200623223904.31643-7-fllinden@amazon.com> (raw)
In-Reply-To: <20200623223904.31643-1-fllinden@amazon.com>

The only consumer of nfs_access_get_cached_rcu and nfs_access_cached
calls these static functions in order to first try RCU access, and
then locked access.

Combine them in to a single function, and call that. Make this function
available to the rest of the NFS code.

Signed-off-by: Frank van der Linden <fllinden@amazon.com>
---
 fs/nfs/dir.c           | 20 ++++++++++++++++----
 include/linux/nfs_fs.h |  2 ++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 5a331da5f55a..f04fc0f7843b 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2460,7 +2460,7 @@ static struct nfs_access_entry *nfs_access_search_rbtree(struct inode *inode, co
 	return NULL;
 }
 
-static int nfs_access_get_cached(struct inode *inode, const struct cred *cred, struct nfs_access_entry *res, bool may_block)
+static int nfs_access_get_cached_locked(struct inode *inode, const struct cred *cred, struct nfs_access_entry *res, bool may_block)
 {
 	struct nfs_inode *nfsi = NFS_I(inode);
 	struct nfs_access_entry *cache;
@@ -2533,6 +2533,20 @@ static int nfs_access_get_cached_rcu(struct inode *inode, const struct cred *cre
 	return err;
 }
 
+int nfs_access_get_cached(struct inode *inode, const struct cred *cred, struct
+nfs_access_entry *res, bool may_block)
+{
+	int status;
+
+	status = nfs_access_get_cached_rcu(inode, cred, res);
+	if (status != 0)
+		status = nfs_access_get_cached_locked(inode, cred, res,
+		    may_block);
+
+	return status;
+}
+EXPORT_SYMBOL_GPL(nfs_access_get_cached);
+
 static void nfs_access_add_rbtree(struct inode *inode, struct nfs_access_entry *set)
 {
 	struct nfs_inode *nfsi = NFS_I(inode);
@@ -2647,9 +2661,7 @@ static int nfs_do_access(struct inode *inode, const struct cred *cred, int mask)
 
 	trace_nfs_access_enter(inode);
 
-	status = nfs_access_get_cached_rcu(inode, cred, &cache);
-	if (status != 0)
-		status = nfs_access_get_cached(inode, cred, &cache, may_block);
+	status = nfs_access_get_cached(inode, cred, &cache, may_block);
 	if (status == 0)
 		goto out_cached;
 
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index b743988fcbd0..714b577dce19 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -493,6 +493,8 @@ extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh,
 			struct nfs_fattr *fattr, struct nfs4_label *label);
 extern int nfs_may_open(struct inode *inode, const struct cred *cred, int openflags);
 extern void nfs_access_zap_cache(struct inode *inode);
+extern int nfs_access_get_cached(struct inode *inode, const struct cred *cred, struct nfs_access_entry *res,
+				 bool may_block);
 
 /*
  * linux/fs/nfs/symlink.c
-- 
2.17.2


  parent reply	other threads:[~2020-06-23 22:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 22:38 [PATCH v3 00/13] client side user xattr (RFC8276) support Frank van der Linden
2020-06-23 22:38 ` [PATCH v3 01/13] nfs,nfsd: NFSv4.2 extended attribute protocol definitions Frank van der Linden
2020-06-23 22:38 ` [PATCH v3 02/13] nfs: add client side only definitions for user xattrs Frank van der Linden
2020-06-23 22:38 ` [PATCH v3 03/13] NFSv4.2: define limits and sizes for user xattr handling Frank van der Linden
2020-06-23 22:38 ` [PATCH v3 04/13] NFSv4.2: query the server for extended attribute support Frank van der Linden
2020-06-23 22:38 ` [PATCH v3 05/13] NFSv4.2: add client side XDR handling for extended attributes Frank van der Linden
2020-06-23 22:38 ` Frank van der Linden [this message]
2020-06-23 22:38 ` [PATCH v3 07/13] NFSv4.2: query the extended attribute access bits Frank van der Linden
2020-06-23 22:38 ` [PATCH v3 08/13] nfs: modify update_changeattr to deal with regular files Frank van der Linden
2020-06-23 22:39 ` [PATCH v3 09/13] nfs: define and use the NFS_INO_INVALID_XATTR flag Frank van der Linden
2020-06-23 22:39 ` [PATCH v3 10/13] nfs: make the buf_to_pages_noslab function available to the nfs code Frank van der Linden
2020-06-23 22:39 ` [PATCH v3 11/13] NFSv4.2: add the extended attribute proc functions Frank van der Linden
2020-06-23 22:39 ` [PATCH v3 12/13] NFSv4.2: hook in the user extended attribute handlers Frank van der Linden
2020-08-21  6:50   ` Murphy Zhou
2020-08-21 16:03     ` Frank van der Linden
2020-08-21 16:41       ` Trond Myklebust
2020-08-24  0:13         ` Murphy Zhou
2020-08-24 16:16           ` Frank van der Linden
2020-08-25  0:14             ` Murphy Zhou
2020-06-23 22:39 ` [PATCH v3 13/13] NFSv4.2: add client side xattr caching Frank van der Linden
2020-07-14 17:20 ` [PATCH v3 00/13] client side user xattr (RFC8276) support van der Linden, Frank

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=20200623223904.31643-7-fllinden@amazon.com \
    --to=fllinden@amazon.com \
    --cc=anna.schumaker@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    /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.