Commit 6f9bda23 authored by Anna Schumaker's avatar Anna Schumaker Committed by Trond Myklebust
Browse files

NFS: Fix directory delegation verifier checks



Doing this check in nfs_check_verifier() resulted in many, many more
lookups on the wire when running Christoph's delegation benchmarking
script. After some experimentation, I found that we can treat directory
delegations exactly the same as having a delegated verifier when we
reach nfs4_lookup_revalidate() for the best performance.

Reported-by: default avatarChristoph Hellwig <hch@lst.de>
Fixes: 156b0948 ("NFS: Request a directory delegation on ACCESS, CREATE, and UNLINK")
Signed-off-by: default avatarAnna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 5a74af51
Loading
Loading
Loading
Loading
+2 −19
Original line number Diff line number Diff line
@@ -1516,14 +1516,6 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry,
	if (!nfs_dentry_verify_change(dir, dentry))
		return 0;

	/*
	 * If we have a directory delegation then we don't need to revalidate
	 * the directory. The delegation will either get recalled or we will
	 * receive a notification when it changes.
	 */
	if (nfs_have_directory_delegation(dir))
		return 0;

	/* Revalidate nfsi->cache_change_attribute before we declare a match */
	if (nfs_mapping_need_revalidate_inode(dir)) {
		if (rcu_walk)
@@ -2216,13 +2208,6 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
}
EXPORT_SYMBOL_GPL(nfs_atomic_open);

static int
nfs_lookup_revalidate_delegated_parent(struct inode *dir, struct dentry *dentry,
				       struct inode *inode)
{
	return nfs_lookup_revalidate_done(dir, dentry, inode, 1);
}

static int
nfs4_lookup_revalidate(struct inode *dir, const struct qstr *name,
		       struct dentry *dentry, unsigned int flags)
@@ -2247,12 +2232,10 @@ nfs4_lookup_revalidate(struct inode *dir, const struct qstr *name,
	if (inode == NULL)
		goto full_reval;

	if (nfs_verifier_is_delegated(dentry))
	if (nfs_verifier_is_delegated(dentry) ||
	    nfs_have_directory_delegation(inode))
		return nfs_lookup_revalidate_delegated(dir, dentry, inode);

	if (nfs_have_directory_delegation(dir))
		return nfs_lookup_revalidate_delegated_parent(dir, dentry, inode);

	/* NFS only supports OPEN on regular files */
	if (!S_ISREG(inode->i_mode))
		goto full_reval;