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 it is zero.
*/
- if ((flags & HAS_SESSION) && in->si_generation == 0)
+ if (has_session && in->si_generation == 0)
goto out;
/* If the client sends us a stateid from the future, it's buggy: */
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;
__be32 status = nfserr_stale_stateid;
if (!stp->st_stateowner->so_confirmed)
goto out;
- status = check_stateid_generation(stateid, &stp->st_stateid, flags);
+ status = check_stateid_generation(stateid, &stp->st_stateid, has_session);
if (status)
goto out;
if (grace_disallows_io(ino))
return nfserr_grace;
- if (nfsd4_has_session(cstate))
- flags |= HAS_SESSION;
-
if (ZERO_STATEID(stateid) || ONE_STATEID(stateid))
return check_special_stateids(current_fh, stateid, flags);
dp = find_delegation_stateid(ino, stateid);
if (!dp)
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)
goto out;
status = nfs4_check_delegmode(dp, flags);
if (!stp->st_stateowner->so_confirmed)
goto out;
status = check_stateid_generation(stateid, &stp->st_stateid,
- flags);
+ nfsd4_has_session(cstate));
if (status)
goto out;
status = nfs4_check_openmode(stp, flags);
if (STALE_STATEID(stateid))
return nfserr_stale_stateid;
- if (nfsd4_has_session(cstate))
- flags |= HAS_SESSION;
-
/*
* We return BAD_STATEID if filehandle doesn't match stateid,
* the confirmed flag is incorrecly set, or the generation
if (lock->lk_is_new) {
if (!sop->so_is_open_owner)
return nfserr_bad_stateid;
- if (!(flags & HAS_SESSION) &&
+ if (!nfsd4_has_session(cstate) &&
!same_clid(&clp->cl_clientid, lockclid))
return nfserr_bad_stateid;
/* stp is the open stateid */
* For the moment, we ignore the possibility of
* generation number wraparound.
*/
- if (!(flags & HAS_SESSION) && seqid != sop->so_seqid)
+ if (!nfsd4_has_session(cstate) && seqid != sop->so_seqid)
goto check_replay;
if (sop->so_confirmed && flags & CONFIRM) {
" confirmed yet!\n");
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)
return status;
renew_client(sop->so_client);
stateid_t *stateid = &dr->dr_stateid;
struct inode *inode;
__be32 status;
- int flags = 0;
if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0)))
return status;
inode = cstate->current_fh.fh_dentry->d_inode;
- if (nfsd4_has_session(cstate))
- flags |= HAS_SESSION;
nfs4_lock_state();
status = nfserr_bad_stateid;
if (ZERO_STATEID(stateid) || ONE_STATEID(stateid))
dp = find_delegation_stateid(inode, stateid);
if (!dp)
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)
goto out;
renew_client(dp->dl_client);