diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-09-17 10:56:50 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-09-17 10:56:50 -0400 |
commit | f46e0bd34ec002d0727761da52b8fd47f06d4440 (patch) | |
tree | bb4ce4d00a9857b370765abf6faf89a09f4c4ff4 /fs/nfs/nfs4proc.c | |
parent | cd9a1c0e5ac681871d64804f82291649e2a0accb (diff) |
NFSv4: Further minor cleanups for nfs4_atomic_open()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 38c3bed2240d..f8d41eed9a6b 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2024,37 +2024,17 @@ out_close: | |||
2024 | return ret; | 2024 | return ret; |
2025 | } | 2025 | } |
2026 | 2026 | ||
2027 | struct dentry * | 2027 | struct inode * |
2028 | nfs4_atomic_open(struct inode *dir, struct nfs_open_context *ctx, int open_flags, struct iattr *attr) | 2028 | nfs4_atomic_open(struct inode *dir, struct nfs_open_context *ctx, int open_flags, struct iattr *attr) |
2029 | { | 2029 | { |
2030 | struct dentry *dentry = ctx->path.dentry; | ||
2031 | struct dentry *parent; | ||
2032 | struct nfs4_state *state; | 2030 | struct nfs4_state *state; |
2033 | struct dentry *res; | ||
2034 | 2031 | ||
2035 | parent = dentry->d_parent; | ||
2036 | /* Protect against concurrent sillydeletes */ | 2032 | /* Protect against concurrent sillydeletes */ |
2037 | nfs_block_sillyrename(parent); | ||
2038 | state = nfs4_do_open(dir, &ctx->path, ctx->mode, open_flags, attr, ctx->cred); | 2033 | state = nfs4_do_open(dir, &ctx->path, ctx->mode, open_flags, attr, ctx->cred); |
2039 | if (IS_ERR(state)) { | 2034 | if (IS_ERR(state)) |
2040 | if (PTR_ERR(state) == -ENOENT) { | 2035 | return ERR_CAST(state); |
2041 | d_add(dentry, NULL); | ||
2042 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | ||
2043 | } | ||
2044 | nfs_unblock_sillyrename(parent); | ||
2045 | return (struct dentry *)state; | ||
2046 | } | ||
2047 | res = d_add_unique(dentry, igrab(state->inode)); | ||
2048 | if (res != NULL) { | ||
2049 | struct dentry *dummy = ctx->path.dentry; | ||
2050 | |||
2051 | ctx->path.dentry = dget(res); | ||
2052 | dput(dummy); | ||
2053 | } | ||
2054 | ctx->state = state; | 2036 | ctx->state = state; |
2055 | nfs_set_verifier(ctx->path.dentry, nfs_save_change_attribute(dir)); | 2037 | return igrab(state->inode); |
2056 | nfs_unblock_sillyrename(parent); | ||
2057 | return res; | ||
2058 | } | 2038 | } |
2059 | 2039 | ||
2060 | int | 2040 | int |