In particular, document that the caller must hold nfsd_mutex. Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> --- 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();