diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-05-29 12:37:49 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-06-06 16:24:42 -0400 |
commit | 4197a055eb06f5fa7e73290b8b710cd32176cd41 (patch) | |
tree | 76f717cf505422248529d6c51aae36f6bdee5115 | |
parent | 1a1a29fa8420e42a760410d9f5b0b51a9eb521eb (diff) |
NFSv4: Cleanup: pass the nfs_open_context to nfs4_do_open
All the callers have an open_context at this point, and since we always
need one in order to do state recovery, it makes sense to use it as the
basis for the nfs4_do_open() call.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 7490359f6c60..32d942d7f343 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1996,18 +1996,19 @@ out: | |||
1996 | * Returns a referenced nfs4_state | 1996 | * Returns a referenced nfs4_state |
1997 | */ | 1997 | */ |
1998 | static int _nfs4_do_open(struct inode *dir, | 1998 | static int _nfs4_do_open(struct inode *dir, |
1999 | struct dentry *dentry, | 1999 | struct nfs_open_context *ctx, |
2000 | fmode_t fmode, | ||
2001 | int flags, | 2000 | int flags, |
2002 | struct iattr *sattr, | 2001 | struct iattr *sattr, |
2003 | struct rpc_cred *cred, | 2002 | struct nfs4_state **res) |
2004 | struct nfs4_state **res, | ||
2005 | struct nfs4_threshold **ctx_th) | ||
2006 | { | 2003 | { |
2007 | struct nfs4_state_owner *sp; | 2004 | struct nfs4_state_owner *sp; |
2008 | struct nfs4_state *state = NULL; | 2005 | struct nfs4_state *state = NULL; |
2009 | struct nfs_server *server = NFS_SERVER(dir); | 2006 | struct nfs_server *server = NFS_SERVER(dir); |
2010 | struct nfs4_opendata *opendata; | 2007 | struct nfs4_opendata *opendata; |
2008 | struct dentry *dentry = ctx->dentry; | ||
2009 | struct rpc_cred *cred = ctx->cred; | ||
2010 | struct nfs4_threshold **ctx_th = &ctx->mdsthreshold; | ||
2011 | fmode_t fmode = ctx->mode & (FMODE_READ|FMODE_WRITE|FMODE_EXEC); | ||
2011 | enum open_claim_type4 claim = NFS4_OPEN_CLAIM_NULL; | 2012 | enum open_claim_type4 claim = NFS4_OPEN_CLAIM_NULL; |
2012 | int status; | 2013 | int status; |
2013 | 2014 | ||
@@ -2079,22 +2080,17 @@ out_err: | |||
2079 | 2080 | ||
2080 | 2081 | ||
2081 | static struct nfs4_state *nfs4_do_open(struct inode *dir, | 2082 | static struct nfs4_state *nfs4_do_open(struct inode *dir, |
2082 | struct dentry *dentry, | 2083 | struct nfs_open_context *ctx, |
2083 | fmode_t fmode, | ||
2084 | int flags, | 2084 | int flags, |
2085 | struct iattr *sattr, | 2085 | struct iattr *sattr) |
2086 | struct rpc_cred *cred, | ||
2087 | struct nfs4_threshold **ctx_th) | ||
2088 | { | 2086 | { |
2089 | struct nfs_server *server = NFS_SERVER(dir); | 2087 | struct nfs_server *server = NFS_SERVER(dir); |
2090 | struct nfs4_exception exception = { }; | 2088 | struct nfs4_exception exception = { }; |
2091 | struct nfs4_state *res; | 2089 | struct nfs4_state *res; |
2092 | int status; | 2090 | int status; |
2093 | 2091 | ||
2094 | fmode &= FMODE_READ|FMODE_WRITE|FMODE_EXEC; | ||
2095 | do { | 2092 | do { |
2096 | status = _nfs4_do_open(dir, dentry, fmode, flags, sattr, cred, | 2093 | status = _nfs4_do_open(dir, ctx, flags, sattr, &res); |
2097 | &res, ctx_th); | ||
2098 | if (status == 0) | 2094 | if (status == 0) |
2099 | break; | 2095 | break; |
2100 | /* NOTE: BAD_SEQID means the server and client disagree about the | 2096 | /* NOTE: BAD_SEQID means the server and client disagree about the |
@@ -2446,8 +2442,7 @@ nfs4_atomic_open(struct inode *dir, struct nfs_open_context *ctx, int open_flags | |||
2446 | struct nfs4_state *state; | 2442 | struct nfs4_state *state; |
2447 | 2443 | ||
2448 | /* Protect against concurrent sillydeletes */ | 2444 | /* Protect against concurrent sillydeletes */ |
2449 | state = nfs4_do_open(dir, ctx->dentry, ctx->mode, open_flags, attr, | 2445 | state = nfs4_do_open(dir, ctx, open_flags, attr); |
2450 | ctx->cred, &ctx->mdsthreshold); | ||
2451 | if (IS_ERR(state)) | 2446 | if (IS_ERR(state)) |
2452 | return ERR_CAST(state); | 2447 | return ERR_CAST(state); |
2453 | ctx->state = state; | 2448 | ctx->state = state; |
@@ -3056,9 +3051,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
3056 | return PTR_ERR(ctx); | 3051 | return PTR_ERR(ctx); |
3057 | 3052 | ||
3058 | sattr->ia_mode &= ~current_umask(); | 3053 | sattr->ia_mode &= ~current_umask(); |
3059 | state = nfs4_do_open(dir, dentry, ctx->mode, | 3054 | state = nfs4_do_open(dir, ctx, flags, sattr); |
3060 | flags, sattr, ctx->cred, | ||
3061 | &ctx->mdsthreshold); | ||
3062 | d_drop(dentry); | 3055 | d_drop(dentry); |
3063 | if (IS_ERR(state)) { | 3056 | if (IS_ERR(state)) { |
3064 | status = PTR_ERR(state); | 3057 | status = PTR_ERR(state); |