Skip to content

Commit b3f0373

Browse files
neilbrownchucklever
authored andcommitted
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: Jeff Layton <[email protected]> Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 23df177 commit b3f0373

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

fs/nfsd/nfs4state.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5346,6 +5346,7 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate,
53465346
open->op_openowner = oo;
53475347
if (!oo)
53485348
return nfserr_jukebox;
5349+
nfsd4_cstate_assign_replay(cstate, &oo->oo_owner);
53495350
status = nfsd4_check_seqid(cstate, &oo->oo_owner, open->op_seqid);
53505351
if (status)
53515352
return status;
@@ -6120,12 +6121,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
61206121
void nfsd4_cleanup_open_state(struct nfsd4_compound_state *cstate,
61216122
struct nfsd4_open *open)
61226123
{
6123-
if (open->op_openowner) {
6124-
struct nfs4_stateowner *so = &open->op_openowner->oo_owner;
6125-
6126-
nfsd4_cstate_assign_replay(cstate, so);
6127-
nfs4_put_stateowner(so);
6128-
}
6124+
if (open->op_openowner)
6125+
nfs4_put_stateowner(&open->op_openowner->oo_owner);
61296126
if (open->op_file)
61306127
kmem_cache_free(file_slab, open->op_file);
61316128
if (open->op_stp)

0 commit comments

Comments
 (0)