Commit b3f03739 authored by NeilBrown's avatar NeilBrown Committed by Chuck Lever

nfsd: move nfsd4_cstate_assign_replay() earlier in open handling.

Rather than taking the rp_mutex (via nfsd4_cstate_assign_replay) in
nfsd4_cleanup_open_state() (which seems counter-intuitive), take it and
assign rp_owner as soon as possible - in nfsd4_process_open1().

This will support a future change when nfsd4_cstate_assign_replay() might
fail.
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 23df1778
...@@ -5346,6 +5346,7 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate, ...@@ -5346,6 +5346,7 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate,
open->op_openowner = oo; open->op_openowner = oo;
if (!oo) if (!oo)
return nfserr_jukebox; return nfserr_jukebox;
nfsd4_cstate_assign_replay(cstate, &oo->oo_owner);
status = nfsd4_check_seqid(cstate, &oo->oo_owner, open->op_seqid); status = nfsd4_check_seqid(cstate, &oo->oo_owner, open->op_seqid);
if (status) if (status)
return status; return status;
...@@ -6120,12 +6121,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf ...@@ -6120,12 +6121,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
void nfsd4_cleanup_open_state(struct nfsd4_compound_state *cstate, void nfsd4_cleanup_open_state(struct nfsd4_compound_state *cstate,
struct nfsd4_open *open) struct nfsd4_open *open)
{ {
if (open->op_openowner) { if (open->op_openowner)
struct nfs4_stateowner *so = &open->op_openowner->oo_owner; nfs4_put_stateowner(&open->op_openowner->oo_owner);
nfsd4_cstate_assign_replay(cstate, so);
nfs4_put_stateowner(so);
}
if (open->op_file) if (open->op_file)
kmem_cache_free(file_slab, open->op_file); kmem_cache_free(file_slab, open->op_file);
if (open->op_stp) if (open->op_stp)
......
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