aboutsummaryrefslogtreecommitdiff
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-09-17 10:56:51 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-09-17 10:56:51 -0400
commitb8d4caddd871758ffa156be51b4c8be82fea470d (patch)
treec388304ca2f1163b2737409ccc4cbc2d29ad3f41 /fs/nfs/nfs4proc.c
parentf46e0bd34ec002d0727761da52b8fd47f06d4440 (diff)
NFSv4: Clean up nfs4_open_revalidate
Remove references to 'struct nameidata' from the low-level open_revalidate code, and replace them with a struct nfs_open_context which will be correctly initialised upon success. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f8d41eed9a6..b4762463b19 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2038,21 +2038,11 @@ nfs4_atomic_open(struct inode *dir, struct nfs_open_context *ctx, int open_flags
}
int
-nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, struct nameidata *nd)
+nfs4_open_revalidate(struct inode *dir, struct nfs_open_context *ctx, int openflags)
{
- struct path path = {
- .mnt = nd->path.mnt,
- .dentry = dentry,
- };
- struct rpc_cred *cred;
struct nfs4_state *state;
- fmode_t fmode = openflags & (FMODE_READ | FMODE_WRITE);
- cred = rpc_lookup_cred();
- if (IS_ERR(cred))
- return PTR_ERR(cred);
- state = nfs4_do_open(dir, &path, fmode, openflags, NULL, cred);
- put_rpccred(cred);
+ state = nfs4_do_open(dir, &ctx->path, ctx->mode, openflags, NULL, ctx->cred);
if (IS_ERR(state)) {
switch (PTR_ERR(state)) {
case -EPERM:
@@ -2065,14 +2055,13 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st
goto out_drop;
}
}
- if (state->inode == dentry->d_inode) {
- nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
- nfs4_intent_set_file(nd, &path, state, fmode);
+ ctx->state = state;
+ if (state->inode == ctx->path.dentry->d_inode) {
+ nfs_set_verifier(ctx->path.dentry, nfs_save_change_attribute(dir));
return 1;
}
- nfs4_close_sync(&path, state, fmode);
out_drop:
- d_drop(dentry);
+ d_drop(ctx->path.dentry);
return 0;
}