Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 217038
b: refs/heads/master
c: 535918f
h: refs/heads/master
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Sep 17, 2010
1 parent 8ca4d45 commit f51601d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b8d4caddd871758ffa156be51b4c8be82fea470d
refs/heads/master: 535918f14176396646b5547b7d1353c932f24f5e
32 changes: 26 additions & 6 deletions trunk/fs/nfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1204,16 +1204,36 @@ static int nfs_open_revalidate(struct dentry *dentry, struct nameidata *nd)
* operations that change the directory. We therefore save the
* change attribute *before* we do the RPC call.
*/
ret = nfs4_open_revalidate(dir, ctx, openflags);
if (ret == 1)
inode = nfs4_atomic_open(dir, ctx, openflags, NULL);
if (IS_ERR(inode)) {
ret = PTR_ERR(inode);
switch (ret) {
case -EPERM:
case -EACCES:
case -EDQUOT:
case -ENOSPC:
case -EROFS:
goto out_put_ctx;
default:
goto out_drop;
}
}
iput(inode);
if (inode == dentry->d_inode) {
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
nfs_intent_set_file(nd, ctx);
else
put_nfs_open_context(ctx);
} else
goto out_drop;
out:
dput(parent);
if (!ret)
d_drop(dentry);
return ret;
out_drop:
d_drop(dentry);
ret = 0;
out_put_ctx:
put_nfs_open_context(ctx);
goto out;

no_open_dput:
dput(parent);
no_open:
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/nfs/nfs4_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *);
extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *);
extern int nfs4_do_close(struct path *path, struct nfs4_state *state, gfp_t gfp_mask, int wait);
extern struct inode *nfs4_atomic_open(struct inode *, struct nfs_open_context *, int, struct iattr *);
extern int nfs4_open_revalidate(struct inode *, struct nfs_open_context *, int);
extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle);
extern int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,
struct nfs4_fs_locations *fs_locations, struct page *page);
Expand Down
28 changes: 0 additions & 28 deletions trunk/fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2037,34 +2037,6 @@ nfs4_atomic_open(struct inode *dir, struct nfs_open_context *ctx, int open_flags
return igrab(state->inode);
}

int
nfs4_open_revalidate(struct inode *dir, struct nfs_open_context *ctx, int openflags)
{
struct nfs4_state *state;

state = nfs4_do_open(dir, &ctx->path, ctx->mode, openflags, NULL, ctx->cred);
if (IS_ERR(state)) {
switch (PTR_ERR(state)) {
case -EPERM:
case -EACCES:
case -EDQUOT:
case -ENOSPC:
case -EROFS:
return PTR_ERR(state);
default:
goto out_drop;
}
}
ctx->state = state;
if (state->inode == ctx->path.dentry->d_inode) {
nfs_set_verifier(ctx->path.dentry, nfs_save_change_attribute(dir));
return 1;
}
out_drop:
d_drop(ctx->path.dentry);
return 0;
}

static void nfs4_close_context(struct nfs_open_context *ctx, int is_sync)
{
if (ctx->state == NULL)
Expand Down

0 comments on commit f51601d

Please sign in to comment.