aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-05-29 13:11:28 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-06-06 16:24:43 -0400
commit275bb307865a316cef390e01e6ab5e21e97023a2 (patch)
treefb7948a7d16dc90a8e6c8959757ae59fc8d21ea9 /fs/nfs/dir.c
parentNFSv4: Refactor _nfs4_open_and_get_state to set ctx->state (diff)
downloadlinux-dev-275bb307865a316cef390e01e6ab5e21e97023a2.tar.xz
linux-dev-275bb307865a316cef390e01e6ab5e21e97023a2.zip
NFSv4: Move dentry instantiation into the NFSv4-specific atomic open code
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index bf4e5f47d686..c662ff6befd6 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1357,11 +1357,6 @@ static int nfs_finish_open(struct nfs_open_context *ctx,
{
int err;
- if (ctx->dentry != dentry) {
- dput(ctx->dentry);
- ctx->dentry = dget(dentry);
- }
-
err = finish_open(file, dentry, do_open, opened);
if (err)
goto out;
@@ -1420,13 +1415,13 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
nfs_block_sillyrename(dentry->d_parent);
inode = NFS_PROTO(dir)->open_context(dir, ctx, open_flags, &attr);
- d_drop(dentry);
+ nfs_unblock_sillyrename(dentry->d_parent);
if (IS_ERR(inode)) {
- nfs_unblock_sillyrename(dentry->d_parent);
put_nfs_open_context(ctx);
err = PTR_ERR(inode);
switch (err) {
case -ENOENT:
+ d_drop(dentry);
d_add(dentry, NULL);
break;
case -EISDIR:
@@ -1442,16 +1437,8 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
}
goto out;
}
- res = d_add_unique(dentry, inode);
- if (res != NULL)
- dentry = res;
-
- nfs_unblock_sillyrename(dentry->d_parent);
- nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
-
- err = nfs_finish_open(ctx, dentry, file, open_flags, opened);
- dput(res);
+ err = nfs_finish_open(ctx, ctx->dentry, file, open_flags, opened);
out:
return err;