[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <165590733727.75778.2800164109345599121.stgit@manet.1015granger.net>
Date: Wed, 22 Jun 2022 10:15:37 -0400
From: Chuck Lever <chuck.lever@...cle.com>
To: linux-nfs@...r.kernel.org, netdev@...r.kernel.org
Cc: david@...morbit.com, tgraf@...g.ch, jlayton@...hat.com
Subject: [PATCH RFC 26/30] NFSD: Document nfsd_file_cache_purge() API contract
In particular, document that the caller must hold nfsd_mutex.
Signed-off-by: Chuck Lever <chuck.lever@...cle.com>
---
fs/nfsd/filecache.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index 8b8d765a0df0..943db8cc87af 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -786,7 +786,10 @@ nfsd_file_cache_init(void)
goto out;
}
-/*
+/**
+ * nfsd_file_cache_purge - Remove all cache items associated with @net
+ * @net: target net namespace
+ *
* Note this can deadlock with nfsd_file_lru_cb.
*/
void
@@ -798,6 +801,8 @@ nfsd_file_cache_purge(struct net *net)
LIST_HEAD(dispose);
bool del;
+ lockdep_assert_held(&nfsd_mutex);
+
if (!nfsd_file_hashtbl)
return;
@@ -1000,6 +1005,7 @@ nfsd_do_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
inode = d_inode(fhp->fh_dentry);
hashval = (unsigned int)hash_long(inode->i_ino, NFSD_FILE_HASH_BITS);
retry:
+ /* Avoid allocation if the item is already in cache */
rcu_read_lock();
nf = nfsd_file_find_locked(inode, may_flags, hashval, net);
rcu_read_unlock();
Powered by blists - more mailing lists