Commit 4197a055 authored by Trond Myklebust's avatar Trond Myklebust

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: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 1a1a29fa
...@@ -1996,18 +1996,19 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, ...@@ -1996,18 +1996,19 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
* Returns a referenced nfs4_state * Returns a referenced nfs4_state
*/ */
static int _nfs4_do_open(struct inode *dir, static int _nfs4_do_open(struct inode *dir,
struct dentry *dentry, struct nfs_open_context *ctx,
fmode_t fmode,
int flags, int flags,
struct iattr *sattr, struct iattr *sattr,
struct rpc_cred *cred, struct nfs4_state **res)
struct nfs4_state **res,
struct nfs4_threshold **ctx_th)
{ {
struct nfs4_state_owner *sp; struct nfs4_state_owner *sp;
struct nfs4_state *state = NULL; struct nfs4_state *state = NULL;
struct nfs_server *server = NFS_SERVER(dir); struct nfs_server *server = NFS_SERVER(dir);
struct nfs4_opendata *opendata; struct nfs4_opendata *opendata;
struct dentry *dentry = ctx->dentry;
struct rpc_cred *cred = ctx->cred;
struct nfs4_threshold **ctx_th = &ctx->mdsthreshold;
fmode_t fmode = ctx->mode & (FMODE_READ|FMODE_WRITE|FMODE_EXEC);
enum open_claim_type4 claim = NFS4_OPEN_CLAIM_NULL; enum open_claim_type4 claim = NFS4_OPEN_CLAIM_NULL;
int status; int status;
...@@ -2079,22 +2080,17 @@ static int _nfs4_do_open(struct inode *dir, ...@@ -2079,22 +2080,17 @@ static int _nfs4_do_open(struct inode *dir,
static struct nfs4_state *nfs4_do_open(struct inode *dir, static struct nfs4_state *nfs4_do_open(struct inode *dir,
struct dentry *dentry, struct nfs_open_context *ctx,
fmode_t fmode,
int flags, int flags,
struct iattr *sattr, struct iattr *sattr)
struct rpc_cred *cred,
struct nfs4_threshold **ctx_th)
{ {
struct nfs_server *server = NFS_SERVER(dir); struct nfs_server *server = NFS_SERVER(dir);
struct nfs4_exception exception = { }; struct nfs4_exception exception = { };
struct nfs4_state *res; struct nfs4_state *res;
int status; int status;
fmode &= FMODE_READ|FMODE_WRITE|FMODE_EXEC;
do { do {
status = _nfs4_do_open(dir, dentry, fmode, flags, sattr, cred, status = _nfs4_do_open(dir, ctx, flags, sattr, &res);
&res, ctx_th);
if (status == 0) if (status == 0)
break; break;
/* NOTE: BAD_SEQID means the server and client disagree about the /* 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,8 +2442,7 @@ nfs4_atomic_open(struct inode *dir, struct nfs_open_context *ctx, int open_flags
struct nfs4_state *state; struct nfs4_state *state;
/* Protect against concurrent sillydeletes */ /* Protect against concurrent sillydeletes */
state = nfs4_do_open(dir, ctx->dentry, ctx->mode, open_flags, attr, state = nfs4_do_open(dir, ctx, open_flags, attr);
ctx->cred, &ctx->mdsthreshold);
if (IS_ERR(state)) if (IS_ERR(state))
return ERR_CAST(state); return ERR_CAST(state);
ctx->state = state; ctx->state = state;
...@@ -3056,9 +3051,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, ...@@ -3056,9 +3051,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
return PTR_ERR(ctx); return PTR_ERR(ctx);
sattr->ia_mode &= ~current_umask(); sattr->ia_mode &= ~current_umask();
state = nfs4_do_open(dir, dentry, ctx->mode, state = nfs4_do_open(dir, ctx, flags, sattr);
flags, sattr, ctx->cred,
&ctx->mdsthreshold);
d_drop(dentry); d_drop(dentry);
if (IS_ERR(state)) { if (IS_ERR(state)) {
status = PTR_ERR(state); status = PTR_ERR(state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment