Commit 28dde241 authored by J. Bruce Fields's avatar J. Bruce Fields

nfsd4: remove HAS_SESSION

This flag doesn't really buy us anything.
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent ff194bd9
...@@ -3168,13 +3168,13 @@ grace_disallows_io(struct inode *inode) ...@@ -3168,13 +3168,13 @@ grace_disallows_io(struct inode *inode)
return locks_in_grace() && mandatory_lock(inode); return locks_in_grace() && mandatory_lock(inode);
} }
static int check_stateid_generation(stateid_t *in, stateid_t *ref, int flags) static int check_stateid_generation(stateid_t *in, stateid_t *ref, bool has_session)
{ {
/* /*
* When sessions are used the stateid generation number is ignored * When sessions are used the stateid generation number is ignored
* when it is zero. * when it is zero.
*/ */
if ((flags & HAS_SESSION) && in->si_generation == 0) if (has_session && in->si_generation == 0)
goto out; goto out;
/* If the client sends us a stateid from the future, it's buggy: */ /* If the client sends us a stateid from the future, it's buggy: */
...@@ -3206,7 +3206,7 @@ static int is_open_stateid(struct nfs4_stateid *stateid) ...@@ -3206,7 +3206,7 @@ static int is_open_stateid(struct nfs4_stateid *stateid)
return stateid->st_openstp == NULL; return stateid->st_openstp == NULL;
} }
__be32 nfs4_validate_stateid(stateid_t *stateid, int flags) __be32 nfs4_validate_stateid(stateid_t *stateid, bool has_session)
{ {
struct nfs4_stateid *stp = NULL; struct nfs4_stateid *stp = NULL;
__be32 status = nfserr_stale_stateid; __be32 status = nfserr_stale_stateid;
...@@ -3223,7 +3223,7 @@ __be32 nfs4_validate_stateid(stateid_t *stateid, int flags) ...@@ -3223,7 +3223,7 @@ __be32 nfs4_validate_stateid(stateid_t *stateid, int flags)
if (!stp->st_stateowner->so_confirmed) if (!stp->st_stateowner->so_confirmed)
goto out; goto out;
status = check_stateid_generation(stateid, &stp->st_stateid, flags); status = check_stateid_generation(stateid, &stp->st_stateid, has_session);
if (status) if (status)
goto out; goto out;
...@@ -3251,9 +3251,6 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, ...@@ -3251,9 +3251,6 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
if (grace_disallows_io(ino)) if (grace_disallows_io(ino))
return nfserr_grace; return nfserr_grace;
if (nfsd4_has_session(cstate))
flags |= HAS_SESSION;
if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) if (ZERO_STATEID(stateid) || ONE_STATEID(stateid))
return check_special_stateids(current_fh, stateid, flags); return check_special_stateids(current_fh, stateid, flags);
...@@ -3270,8 +3267,7 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, ...@@ -3270,8 +3267,7 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
dp = find_delegation_stateid(ino, stateid); dp = find_delegation_stateid(ino, stateid);
if (!dp) if (!dp)
goto out; goto out;
status = check_stateid_generation(stateid, &dp->dl_stateid, status = check_stateid_generation(stateid, &dp->dl_stateid, nfsd4_has_session(cstate));
flags);
if (status) if (status)
goto out; goto out;
status = nfs4_check_delegmode(dp, flags); status = nfs4_check_delegmode(dp, flags);
...@@ -3292,7 +3288,7 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, ...@@ -3292,7 +3288,7 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
if (!stp->st_stateowner->so_confirmed) if (!stp->st_stateowner->so_confirmed)
goto out; goto out;
status = check_stateid_generation(stateid, &stp->st_stateid, status = check_stateid_generation(stateid, &stp->st_stateid,
flags); nfsd4_has_session(cstate));
if (status) if (status)
goto out; goto out;
status = nfs4_check_openmode(stp, flags); status = nfs4_check_openmode(stp, flags);
...@@ -3421,9 +3417,6 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, ...@@ -3421,9 +3417,6 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
if (STALE_STATEID(stateid)) if (STALE_STATEID(stateid))
return nfserr_stale_stateid; return nfserr_stale_stateid;
if (nfsd4_has_session(cstate))
flags |= HAS_SESSION;
/* /*
* We return BAD_STATEID if filehandle doesn't match stateid, * We return BAD_STATEID if filehandle doesn't match stateid,
* the confirmed flag is incorrecly set, or the generation * the confirmed flag is incorrecly set, or the generation
...@@ -3457,7 +3450,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, ...@@ -3457,7 +3450,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
if (lock->lk_is_new) { if (lock->lk_is_new) {
if (!sop->so_is_open_owner) if (!sop->so_is_open_owner)
return nfserr_bad_stateid; return nfserr_bad_stateid;
if (!(flags & HAS_SESSION) && if (!nfsd4_has_session(cstate) &&
!same_clid(&clp->cl_clientid, lockclid)) !same_clid(&clp->cl_clientid, lockclid))
return nfserr_bad_stateid; return nfserr_bad_stateid;
/* stp is the open stateid */ /* stp is the open stateid */
...@@ -3482,7 +3475,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, ...@@ -3482,7 +3475,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
* For the moment, we ignore the possibility of * For the moment, we ignore the possibility of
* generation number wraparound. * generation number wraparound.
*/ */
if (!(flags & HAS_SESSION) && seqid != sop->so_seqid) if (!nfsd4_has_session(cstate) && seqid != sop->so_seqid)
goto check_replay; goto check_replay;
if (sop->so_confirmed && flags & CONFIRM) { if (sop->so_confirmed && flags & CONFIRM) {
...@@ -3495,7 +3488,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, ...@@ -3495,7 +3488,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
" confirmed yet!\n"); " confirmed yet!\n");
return nfserr_bad_stateid; return nfserr_bad_stateid;
} }
status = check_stateid_generation(stateid, &stp->st_stateid, flags); status = check_stateid_generation(stateid, &stp->st_stateid, nfsd4_has_session(cstate));
if (status) if (status)
return status; return status;
renew_client(sop->so_client); renew_client(sop->so_client);
...@@ -3679,14 +3672,11 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -3679,14 +3672,11 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
stateid_t *stateid = &dr->dr_stateid; stateid_t *stateid = &dr->dr_stateid;
struct inode *inode; struct inode *inode;
__be32 status; __be32 status;
int flags = 0;
if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0))) if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0)))
return status; return status;
inode = cstate->current_fh.fh_dentry->d_inode; inode = cstate->current_fh.fh_dentry->d_inode;
if (nfsd4_has_session(cstate))
flags |= HAS_SESSION;
nfs4_lock_state(); nfs4_lock_state();
status = nfserr_bad_stateid; status = nfserr_bad_stateid;
if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) if (ZERO_STATEID(stateid) || ONE_STATEID(stateid))
...@@ -3701,7 +3691,7 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -3701,7 +3691,7 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
dp = find_delegation_stateid(inode, stateid); dp = find_delegation_stateid(inode, stateid);
if (!dp) if (!dp)
goto out; goto out;
status = check_stateid_generation(stateid, &dp->dl_stateid, flags); status = check_stateid_generation(stateid, &dp->dl_stateid, nfsd4_has_session(cstate));
if (status) if (status)
goto out; goto out;
renew_client(dp->dl_client); renew_client(dp->dl_client);
......
...@@ -439,7 +439,6 @@ struct nfs4_stateid { ...@@ -439,7 +439,6 @@ struct nfs4_stateid {
}; };
/* flags for preprocess_seqid_op() */ /* flags for preprocess_seqid_op() */
#define HAS_SESSION 0x00000001
#define CONFIRM 0x00000002 #define CONFIRM 0x00000002
#define OPEN_STATE 0x00000004 #define OPEN_STATE 0x00000004
#define LOCK_STATE 0x00000008 #define LOCK_STATE 0x00000008
...@@ -476,7 +475,7 @@ extern void nfsd4_recdir_purge_old(void); ...@@ -476,7 +475,7 @@ extern void nfsd4_recdir_purge_old(void);
extern int nfsd4_create_clid_dir(struct nfs4_client *clp); extern int nfsd4_create_clid_dir(struct nfs4_client *clp);
extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); extern void nfsd4_remove_clid_dir(struct nfs4_client *clp);
extern void release_session_client(struct nfsd4_session *); extern void release_session_client(struct nfsd4_session *);
extern __be32 nfs4_validate_stateid(stateid_t *, int); extern __be32 nfs4_validate_stateid(stateid_t *, bool);
static inline void static inline void
nfs4_put_stateowner(struct nfs4_stateowner *so) nfs4_put_stateowner(struct nfs4_stateowner *so)
......
...@@ -351,7 +351,7 @@ struct nfsd4_saved_compoundargs { ...@@ -351,7 +351,7 @@ struct nfsd4_saved_compoundargs {
struct nfsd4_test_stateid { struct nfsd4_test_stateid {
__be32 ts_num_ids; __be32 ts_num_ids;
__be32 ts_has_session; bool ts_has_session;
struct nfsd4_compoundargs *ts_saved_args; struct nfsd4_compoundargs *ts_saved_args;
struct nfsd4_saved_compoundargs ts_savedp; struct nfsd4_saved_compoundargs ts_savedp;
}; };
......
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