diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-05-29 13:17:04 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-06-06 16:24:42 -0400 |
commit | 3efb9722475e56c8878ce09395dd8ccb7a1a3611 (patch) | |
tree | 95b26a56565040fbd6f96e00ed7e5777abdea531 /fs/nfs/nfs4proc.c | |
parent | 4197a055eb06f5fa7e73290b8b710cd32176cd41 (diff) |
NFSv4: Refactor _nfs4_open_and_get_state to set ctx->state
Instead of having the callers set ctx->state, do it inside
_nfs4_open_and_get_state.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 32d942d7f343..70f378f071d8 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1960,7 +1960,7 @@ static inline void nfs4_exclusive_attrset(struct nfs4_opendata *opendata, struct | |||
1960 | static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, | 1960 | static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, |
1961 | fmode_t fmode, | 1961 | fmode_t fmode, |
1962 | int flags, | 1962 | int flags, |
1963 | struct nfs4_state **res) | 1963 | struct nfs_open_context *ctx) |
1964 | { | 1964 | { |
1965 | struct nfs4_state_owner *sp = opendata->owner; | 1965 | struct nfs4_state_owner *sp = opendata->owner; |
1966 | struct nfs_server *server = sp->so_server; | 1966 | struct nfs_server *server = sp->so_server; |
@@ -1985,9 +1985,9 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, | |||
1985 | if (ret != 0) | 1985 | if (ret != 0) |
1986 | goto out; | 1986 | goto out; |
1987 | 1987 | ||
1988 | ctx->state = state; | ||
1988 | if (read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) | 1989 | if (read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) |
1989 | nfs4_schedule_stateid_recovery(server, state); | 1990 | nfs4_schedule_stateid_recovery(server, state); |
1990 | *res = state; | ||
1991 | out: | 1991 | out: |
1992 | return ret; | 1992 | return ret; |
1993 | } | 1993 | } |
@@ -1998,8 +1998,7 @@ out: | |||
1998 | static int _nfs4_do_open(struct inode *dir, | 1998 | static int _nfs4_do_open(struct inode *dir, |
1999 | struct nfs_open_context *ctx, | 1999 | struct nfs_open_context *ctx, |
2000 | int flags, | 2000 | int flags, |
2001 | struct iattr *sattr, | 2001 | struct iattr *sattr) |
2002 | struct nfs4_state **res) | ||
2003 | { | 2002 | { |
2004 | struct nfs4_state_owner *sp; | 2003 | struct nfs4_state_owner *sp; |
2005 | struct nfs4_state *state = NULL; | 2004 | struct nfs4_state *state = NULL; |
@@ -2041,9 +2040,10 @@ static int _nfs4_do_open(struct inode *dir, | |||
2041 | if (dentry->d_inode != NULL) | 2040 | if (dentry->d_inode != NULL) |
2042 | opendata->state = nfs4_get_open_state(dentry->d_inode, sp); | 2041 | opendata->state = nfs4_get_open_state(dentry->d_inode, sp); |
2043 | 2042 | ||
2044 | status = _nfs4_open_and_get_state(opendata, fmode, flags, &state); | 2043 | status = _nfs4_open_and_get_state(opendata, fmode, flags, ctx); |
2045 | if (status != 0) | 2044 | if (status != 0) |
2046 | goto err_opendata_put; | 2045 | goto err_opendata_put; |
2046 | state = ctx->state; | ||
2047 | 2047 | ||
2048 | if ((opendata->o_arg.open_flags & O_EXCL) && | 2048 | if ((opendata->o_arg.open_flags & O_EXCL) && |
2049 | (opendata->o_arg.createmode != NFS4_CREATE_GUARDED)) { | 2049 | (opendata->o_arg.createmode != NFS4_CREATE_GUARDED)) { |
@@ -2066,7 +2066,6 @@ static int _nfs4_do_open(struct inode *dir, | |||
2066 | 2066 | ||
2067 | nfs4_opendata_put(opendata); | 2067 | nfs4_opendata_put(opendata); |
2068 | nfs4_put_state_owner(sp); | 2068 | nfs4_put_state_owner(sp); |
2069 | *res = state; | ||
2070 | return 0; | 2069 | return 0; |
2071 | err_opendata_put: | 2070 | err_opendata_put: |
2072 | kfree(opendata->f_attr.mdsthreshold); | 2071 | kfree(opendata->f_attr.mdsthreshold); |
@@ -2074,7 +2073,6 @@ err_opendata_put: | |||
2074 | err_put_state_owner: | 2073 | err_put_state_owner: |
2075 | nfs4_put_state_owner(sp); | 2074 | nfs4_put_state_owner(sp); |
2076 | out_err: | 2075 | out_err: |
2077 | *res = NULL; | ||
2078 | return status; | 2076 | return status; |
2079 | } | 2077 | } |
2080 | 2078 | ||
@@ -2090,7 +2088,8 @@ static struct nfs4_state *nfs4_do_open(struct inode *dir, | |||
2090 | int status; | 2088 | int status; |
2091 | 2089 | ||
2092 | do { | 2090 | do { |
2093 | status = _nfs4_do_open(dir, ctx, flags, sattr, &res); | 2091 | status = _nfs4_do_open(dir, ctx, flags, sattr); |
2092 | res = ctx->state; | ||
2094 | if (status == 0) | 2093 | if (status == 0) |
2095 | break; | 2094 | break; |
2096 | /* NOTE: BAD_SEQID means the server and client disagree about the | 2095 | /* NOTE: BAD_SEQID means the server and client disagree about the |
@@ -2445,7 +2444,6 @@ nfs4_atomic_open(struct inode *dir, struct nfs_open_context *ctx, int open_flags | |||
2445 | state = nfs4_do_open(dir, ctx, open_flags, attr); | 2444 | state = nfs4_do_open(dir, ctx, open_flags, attr); |
2446 | if (IS_ERR(state)) | 2445 | if (IS_ERR(state)) |
2447 | return ERR_CAST(state); | 2446 | return ERR_CAST(state); |
2448 | ctx->state = state; | ||
2449 | return igrab(state->inode); | 2447 | return igrab(state->inode); |
2450 | } | 2448 | } |
2451 | 2449 | ||
@@ -3059,7 +3057,6 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
3059 | } | 3057 | } |
3060 | d_add(dentry, igrab(state->inode)); | 3058 | d_add(dentry, igrab(state->inode)); |
3061 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | 3059 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); |
3062 | ctx->state = state; | ||
3063 | out: | 3060 | out: |
3064 | put_nfs_open_context(ctx); | 3061 | put_nfs_open_context(ctx); |
3065 | return status; | 3062 | return status; |