Loading fs/nfsd/current_stateid.h +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ #include "state.h" #include "xdr4.h" extern void clear_current_stateid(struct nfsd4_compound_state *cstate); /* * functions to set current state id */ Loading fs/nfsd/nfs4proc.c +9 −3 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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; } Loading Loading @@ -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); Loading fs/nfsd/nfs4state.c +12 −4 Original line number Diff line number Diff line Loading @@ -4699,15 +4699,23 @@ nfs4_state_shutdown(void) static void get_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid) { if (cstate->current_stateid && CURRENT_STATEID(stateid)) memcpy(stateid, cstate->current_stateid, sizeof(stateid_t)); if (HAS_STATE_ID(cstate, CURRENT_STATE_ID_FLAG) && CURRENT_STATEID(stateid)) memcpy(stateid, &cstate->current_stateid, sizeof(stateid_t)); } static void put_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid) { if (cstate->minorversion) cstate->current_stateid = stateid; if (cstate->minorversion) { memcpy(&cstate->current_stateid, stateid, sizeof(stateid_t)); SET_STATE_ID(cstate, CURRENT_STATE_ID_FLAG); } } void clear_current_stateid(struct nfsd4_compound_state *cstate) { CLEAR_STATE_ID(cstate, CURRENT_STATE_ID_FLAG); } /* Loading fs/nfsd/xdr4.h +11 −2 Original line number Diff line number Diff line Loading @@ -43,6 +43,13 @@ #define NFSD4_MAX_TAGLEN 128 #define XDR_LEN(n) (((n) + 3) & ~3) #define CURRENT_STATE_ID_FLAG (1<<0) #define SAVED_STATE_ID_FLAG (1<<1) #define SET_STATE_ID(c, f) ((c)->sid_flags |= (f)) #define HAS_STATE_ID(c, f) ((c)->sid_flags & (f)) #define CLEAR_STATE_ID(c, f) ((c)->sid_flags &= ~(f)) struct nfsd4_compound_state { struct svc_fh current_fh; struct svc_fh save_fh; Loading @@ -54,8 +61,10 @@ struct nfsd4_compound_state { size_t iovlen; u32 minorversion; u32 status; const stateid_t *current_stateid; const stateid_t *save_stateid; stateid_t current_stateid; stateid_t save_stateid; /* to indicate current and saved state id presents */ u32 sid_flags; }; static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs) Loading Loading
fs/nfsd/current_stateid.h +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ #include "state.h" #include "xdr4.h" extern void clear_current_stateid(struct nfsd4_compound_state *cstate); /* * functions to set current state id */ Loading
fs/nfsd/nfs4proc.c +9 −3 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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; } Loading Loading @@ -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); Loading
fs/nfsd/nfs4state.c +12 −4 Original line number Diff line number Diff line Loading @@ -4699,15 +4699,23 @@ nfs4_state_shutdown(void) static void get_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid) { if (cstate->current_stateid && CURRENT_STATEID(stateid)) memcpy(stateid, cstate->current_stateid, sizeof(stateid_t)); if (HAS_STATE_ID(cstate, CURRENT_STATE_ID_FLAG) && CURRENT_STATEID(stateid)) memcpy(stateid, &cstate->current_stateid, sizeof(stateid_t)); } static void put_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid) { if (cstate->minorversion) cstate->current_stateid = stateid; if (cstate->minorversion) { memcpy(&cstate->current_stateid, stateid, sizeof(stateid_t)); SET_STATE_ID(cstate, CURRENT_STATE_ID_FLAG); } } void clear_current_stateid(struct nfsd4_compound_state *cstate) { CLEAR_STATE_ID(cstate, CURRENT_STATE_ID_FLAG); } /* Loading
fs/nfsd/xdr4.h +11 −2 Original line number Diff line number Diff line Loading @@ -43,6 +43,13 @@ #define NFSD4_MAX_TAGLEN 128 #define XDR_LEN(n) (((n) + 3) & ~3) #define CURRENT_STATE_ID_FLAG (1<<0) #define SAVED_STATE_ID_FLAG (1<<1) #define SET_STATE_ID(c, f) ((c)->sid_flags |= (f)) #define HAS_STATE_ID(c, f) ((c)->sid_flags & (f)) #define CLEAR_STATE_ID(c, f) ((c)->sid_flags &= ~(f)) struct nfsd4_compound_state { struct svc_fh current_fh; struct svc_fh save_fh; Loading @@ -54,8 +61,10 @@ struct nfsd4_compound_state { size_t iovlen; u32 minorversion; u32 status; const stateid_t *current_stateid; const stateid_t *save_stateid; stateid_t current_stateid; stateid_t save_stateid; /* to indicate current and saved state id presents */ u32 sid_flags; }; static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs) Loading