Skip to content

Commit 6f9bda2

Browse files
Anna SchumakerTrond Myklebust
authored andcommitted
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: Christoph Hellwig <hch@lst.de> Fixes: 156b094 ("NFS: Request a directory delegation on ACCESS, CREATE, and UNLINK") Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 5a74af5 commit 6f9bda2

1 file changed

Lines changed: 2 additions & 19 deletions

File tree

fs/nfs/dir.c

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,14 +1516,6 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry,
15161516
if (!nfs_dentry_verify_change(dir, dentry))
15171517
return 0;
15181518

1519-
/*
1520-
* If we have a directory delegation then we don't need to revalidate
1521-
* the directory. The delegation will either get recalled or we will
1522-
* receive a notification when it changes.
1523-
*/
1524-
if (nfs_have_directory_delegation(dir))
1525-
return 0;
1526-
15271519
/* Revalidate nfsi->cache_change_attribute before we declare a match */
15281520
if (nfs_mapping_need_revalidate_inode(dir)) {
15291521
if (rcu_walk)
@@ -2216,13 +2208,6 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
22162208
}
22172209
EXPORT_SYMBOL_GPL(nfs_atomic_open);
22182210

2219-
static int
2220-
nfs_lookup_revalidate_delegated_parent(struct inode *dir, struct dentry *dentry,
2221-
struct inode *inode)
2222-
{
2223-
return nfs_lookup_revalidate_done(dir, dentry, inode, 1);
2224-
}
2225-
22262211
static int
22272212
nfs4_lookup_revalidate(struct inode *dir, const struct qstr *name,
22282213
struct dentry *dentry, unsigned int flags)
@@ -2247,12 +2232,10 @@ nfs4_lookup_revalidate(struct inode *dir, const struct qstr *name,
22472232
if (inode == NULL)
22482233
goto full_reval;
22492234

2250-
if (nfs_verifier_is_delegated(dentry))
2235+
if (nfs_verifier_is_delegated(dentry) ||
2236+
nfs_have_directory_delegation(inode))
22512237
return nfs_lookup_revalidate_delegated(dir, dentry, inode);
22522238

2253-
if (nfs_have_directory_delegation(dir))
2254-
return nfs_lookup_revalidate_delegated_parent(dir, dentry, inode);
2255-
22562239
/* NFS only supports OPEN on regular files */
22572240
if (!S_ISREG(inode->i_mode))
22582241
goto full_reval;

0 commit comments

Comments
 (0)