From 37c593c57324740821766c56e48cf09776a68a9c Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Mon, 13 Feb 2012 22:55:32 +0100 Subject: nfsd41: use current stateid by value Signed-off-by: Tigran Mkrtchyan Signed-off-by: J. Bruce Fields --- fs/nfsd/nfs4proc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'fs/nfsd/nfs4proc.c') diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 1ee0e7c..53636ff 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -453,7 +453,10 @@ nfsd4_restorefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, return nfserr_restorefh; fh_dup2(&cstate->current_fh, &cstate->save_fh); - cstate->current_stateid = cstate->save_stateid; + if (HAS_STATE_ID(cstate, SAVED_STATE_ID_FLAG)) { + memcpy(&cstate->current_stateid, &cstate->save_stateid, sizeof(stateid_t)); + SET_STATE_ID(cstate, CURRENT_STATE_ID_FLAG); + } return nfs_ok; } @@ -465,7 +468,10 @@ nfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, return nfserr_nofilehandle; fh_dup2(&cstate->save_fh, &cstate->current_fh); - cstate->save_stateid = cstate->current_stateid; + if (HAS_STATE_ID(cstate, CURRENT_STATE_ID_FLAG)) { + memcpy(&cstate->save_stateid, &cstate->current_stateid, sizeof(stateid_t)); + SET_STATE_ID(cstate, SAVED_STATE_ID_FLAG); + } return nfs_ok; } @@ -1238,7 +1244,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, opdesc->op_set_currentstateid(cstate, &op->u); if (opdesc->op_flags & OP_CLEAR_STATEID) - cstate->current_stateid = NULL; + clear_current_stateid(cstate); if (need_wrongsec_check(rqstp)) op->status = check_nfsd_access(cstate->current_fh.fh_export, rqstp); -- cgit v1.1