Skip to content

Commit

Permalink
NFS: teach nfs_lookup_verify_inode to handle LOOKUP_RCU
Browse files Browse the repository at this point in the history
It fails with -ECHILD rather than make an RPC call.

This allows nfs_lookup_revalidate to call it in RCU-walk mode.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
  • Loading branch information
NeilBrown authored and Trond Myklebust committed Aug 3, 2014
1 parent 912a108 commit 1fa1e38
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fs/nfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,8 @@ int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags)
out:
return (inode->i_nlink == 0) ? -ENOENT : 0;
out_force:
if (flags & LOOKUP_RCU)
return -ECHILD;
ret = __nfs_revalidate_inode(server, inode);
if (ret != 0)
return ret;
Expand Down Expand Up @@ -1135,11 +1137,11 @@ static int nfs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
if (!nfs_is_exclusive_create(dir, flags) &&
nfs_check_verifier(dir, dentry, flags & LOOKUP_RCU)) {

if (flags & LOOKUP_RCU)
return -ECHILD;

if (nfs_lookup_verify_inode(inode, flags))
if (nfs_lookup_verify_inode(inode, flags)) {
if (flags & LOOKUP_RCU)
return -ECHILD;
goto out_zap_parent;
}
goto out_valid;
}

Expand Down

0 comments on commit 1fa1e38

Please sign in to comment.