diff options
author | J. Bruce Fields <bfields@redhat.com> | 2011-08-22 10:07:12 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2011-08-27 14:21:25 -0400 |
commit | 28dde241cc65c9464b7627d9a9ed3a66e4df2586 (patch) | |
tree | 04493c82150823594091393b52db2153286fe6b0 /fs | |
parent | ff194bd95959ea9047d536b4f4ad6a992754e48d (diff) |
nfsd4: remove HAS_SESSION
This flag doesn't really buy us anything.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4state.c | 30 | ||||
-rw-r--r-- | fs/nfsd/state.h | 3 | ||||
-rw-r--r-- | fs/nfsd/xdr4.h | 2 |
3 files changed, 12 insertions, 23 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 3e64288399f7..14c8dd64e136 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -3168,13 +3168,13 @@ grace_disallows_io(struct inode *inode) | |||
3168 | return locks_in_grace() && mandatory_lock(inode); | 3168 | return locks_in_grace() && mandatory_lock(inode); |
3169 | } | 3169 | } |
3170 | 3170 | ||
3171 | static int check_stateid_generation(stateid_t *in, stateid_t *ref, int flags) | 3171 | static int check_stateid_generation(stateid_t *in, stateid_t *ref, bool has_session) |
3172 | { | 3172 | { |
3173 | /* | 3173 | /* |
3174 | * When sessions are used the stateid generation number is ignored | 3174 | * When sessions are used the stateid generation number is ignored |
3175 | * when it is zero. | 3175 | * when it is zero. |
3176 | */ | 3176 | */ |
3177 | if ((flags & HAS_SESSION) && in->si_generation == 0) | 3177 | if (has_session && in->si_generation == 0) |
3178 | goto out; | 3178 | goto out; |
3179 | 3179 | ||
3180 | /* If the client sends us a stateid from the future, it's buggy: */ | 3180 | /* 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 | return stateid->st_openstp == NULL; | 3206 | return stateid->st_openstp == NULL; |
3207 | } | 3207 | } |
3208 | 3208 | ||
3209 | __be32 nfs4_validate_stateid(stateid_t *stateid, int flags) | 3209 | __be32 nfs4_validate_stateid(stateid_t *stateid, bool has_session) |
3210 | { | 3210 | { |
3211 | struct nfs4_stateid *stp = NULL; | 3211 | struct nfs4_stateid *stp = NULL; |
3212 | __be32 status = nfserr_stale_stateid; | 3212 | __be32 status = nfserr_stale_stateid; |
@@ -3223,7 +3223,7 @@ __be32 nfs4_validate_stateid(stateid_t *stateid, int flags) | |||
3223 | if (!stp->st_stateowner->so_confirmed) | 3223 | if (!stp->st_stateowner->so_confirmed) |
3224 | goto out; | 3224 | goto out; |
3225 | 3225 | ||
3226 | status = check_stateid_generation(stateid, &stp->st_stateid, flags); | 3226 | status = check_stateid_generation(stateid, &stp->st_stateid, has_session); |
3227 | if (status) | 3227 | if (status) |
3228 | goto out; | 3228 | goto out; |
3229 | 3229 | ||
@@ -3251,9 +3251,6 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | |||
3251 | if (grace_disallows_io(ino)) | 3251 | if (grace_disallows_io(ino)) |
3252 | return nfserr_grace; | 3252 | return nfserr_grace; |
3253 | 3253 | ||
3254 | if (nfsd4_has_session(cstate)) | ||
3255 | flags |= HAS_SESSION; | ||
3256 | |||
3257 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) | 3254 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) |
3258 | return check_special_stateids(current_fh, stateid, flags); | 3255 | return check_special_stateids(current_fh, stateid, flags); |
3259 | 3256 | ||
@@ -3270,8 +3267,7 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | |||
3270 | dp = find_delegation_stateid(ino, stateid); | 3267 | dp = find_delegation_stateid(ino, stateid); |
3271 | if (!dp) | 3268 | if (!dp) |
3272 | goto out; | 3269 | goto out; |
3273 | status = check_stateid_generation(stateid, &dp->dl_stateid, | 3270 | status = check_stateid_generation(stateid, &dp->dl_stateid, nfsd4_has_session(cstate)); |
3274 | flags); | ||
3275 | if (status) | 3271 | if (status) |
3276 | goto out; | 3272 | goto out; |
3277 | status = nfs4_check_delegmode(dp, flags); | 3273 | status = nfs4_check_delegmode(dp, flags); |
@@ -3292,7 +3288,7 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | |||
3292 | if (!stp->st_stateowner->so_confirmed) | 3288 | if (!stp->st_stateowner->so_confirmed) |
3293 | goto out; | 3289 | goto out; |
3294 | status = check_stateid_generation(stateid, &stp->st_stateid, | 3290 | status = check_stateid_generation(stateid, &stp->st_stateid, |
3295 | flags); | 3291 | nfsd4_has_session(cstate)); |
3296 | if (status) | 3292 | if (status) |
3297 | goto out; | 3293 | goto out; |
3298 | status = nfs4_check_openmode(stp, flags); | 3294 | status = nfs4_check_openmode(stp, flags); |
@@ -3421,9 +3417,6 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | |||
3421 | if (STALE_STATEID(stateid)) | 3417 | if (STALE_STATEID(stateid)) |
3422 | return nfserr_stale_stateid; | 3418 | return nfserr_stale_stateid; |
3423 | 3419 | ||
3424 | if (nfsd4_has_session(cstate)) | ||
3425 | flags |= HAS_SESSION; | ||
3426 | |||
3427 | /* | 3420 | /* |
3428 | * We return BAD_STATEID if filehandle doesn't match stateid, | 3421 | * We return BAD_STATEID if filehandle doesn't match stateid, |
3429 | * the confirmed flag is incorrecly set, or the generation | 3422 | * 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 | if (lock->lk_is_new) { | 3450 | if (lock->lk_is_new) { |
3458 | if (!sop->so_is_open_owner) | 3451 | if (!sop->so_is_open_owner) |
3459 | return nfserr_bad_stateid; | 3452 | return nfserr_bad_stateid; |
3460 | if (!(flags & HAS_SESSION) && | 3453 | if (!nfsd4_has_session(cstate) && |
3461 | !same_clid(&clp->cl_clientid, lockclid)) | 3454 | !same_clid(&clp->cl_clientid, lockclid)) |
3462 | return nfserr_bad_stateid; | 3455 | return nfserr_bad_stateid; |
3463 | /* stp is the open stateid */ | 3456 | /* stp is the open stateid */ |
@@ -3482,7 +3475,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | |||
3482 | * For the moment, we ignore the possibility of | 3475 | * For the moment, we ignore the possibility of |
3483 | * generation number wraparound. | 3476 | * generation number wraparound. |
3484 | */ | 3477 | */ |
3485 | if (!(flags & HAS_SESSION) && seqid != sop->so_seqid) | 3478 | if (!nfsd4_has_session(cstate) && seqid != sop->so_seqid) |
3486 | goto check_replay; | 3479 | goto check_replay; |
3487 | 3480 | ||
3488 | if (sop->so_confirmed && flags & CONFIRM) { | 3481 | if (sop->so_confirmed && flags & CONFIRM) { |
@@ -3495,7 +3488,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | |||
3495 | " confirmed yet!\n"); | 3488 | " confirmed yet!\n"); |
3496 | return nfserr_bad_stateid; | 3489 | return nfserr_bad_stateid; |
3497 | } | 3490 | } |
3498 | status = check_stateid_generation(stateid, &stp->st_stateid, flags); | 3491 | status = check_stateid_generation(stateid, &stp->st_stateid, nfsd4_has_session(cstate)); |
3499 | if (status) | 3492 | if (status) |
3500 | return status; | 3493 | return status; |
3501 | renew_client(sop->so_client); | 3494 | renew_client(sop->so_client); |
@@ -3679,14 +3672,11 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3679 | stateid_t *stateid = &dr->dr_stateid; | 3672 | stateid_t *stateid = &dr->dr_stateid; |
3680 | struct inode *inode; | 3673 | struct inode *inode; |
3681 | __be32 status; | 3674 | __be32 status; |
3682 | int flags = 0; | ||
3683 | 3675 | ||
3684 | if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0))) | 3676 | if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0))) |
3685 | return status; | 3677 | return status; |
3686 | inode = cstate->current_fh.fh_dentry->d_inode; | 3678 | inode = cstate->current_fh.fh_dentry->d_inode; |
3687 | 3679 | ||
3688 | if (nfsd4_has_session(cstate)) | ||
3689 | flags |= HAS_SESSION; | ||
3690 | nfs4_lock_state(); | 3680 | nfs4_lock_state(); |
3691 | status = nfserr_bad_stateid; | 3681 | status = nfserr_bad_stateid; |
3692 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) | 3682 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) |
@@ -3701,7 +3691,7 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3701 | dp = find_delegation_stateid(inode, stateid); | 3691 | dp = find_delegation_stateid(inode, stateid); |
3702 | if (!dp) | 3692 | if (!dp) |
3703 | goto out; | 3693 | goto out; |
3704 | status = check_stateid_generation(stateid, &dp->dl_stateid, flags); | 3694 | status = check_stateid_generation(stateid, &dp->dl_stateid, nfsd4_has_session(cstate)); |
3705 | if (status) | 3695 | if (status) |
3706 | goto out; | 3696 | goto out; |
3707 | renew_client(dp->dl_client); | 3697 | renew_client(dp->dl_client); |
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 12c1b1ef52ec..f02badd70cf2 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
@@ -439,7 +439,6 @@ struct nfs4_stateid { | |||
439 | }; | 439 | }; |
440 | 440 | ||
441 | /* flags for preprocess_seqid_op() */ | 441 | /* flags for preprocess_seqid_op() */ |
442 | #define HAS_SESSION 0x00000001 | ||
443 | #define CONFIRM 0x00000002 | 442 | #define CONFIRM 0x00000002 |
444 | #define OPEN_STATE 0x00000004 | 443 | #define OPEN_STATE 0x00000004 |
445 | #define LOCK_STATE 0x00000008 | 444 | #define LOCK_STATE 0x00000008 |
@@ -476,7 +475,7 @@ extern void nfsd4_recdir_purge_old(void); | |||
476 | extern int nfsd4_create_clid_dir(struct nfs4_client *clp); | 475 | extern int nfsd4_create_clid_dir(struct nfs4_client *clp); |
477 | extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); | 476 | extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); |
478 | extern void release_session_client(struct nfsd4_session *); | 477 | extern void release_session_client(struct nfsd4_session *); |
479 | extern __be32 nfs4_validate_stateid(stateid_t *, int); | 478 | extern __be32 nfs4_validate_stateid(stateid_t *, bool); |
480 | 479 | ||
481 | static inline void | 480 | static inline void |
482 | nfs4_put_stateowner(struct nfs4_stateowner *so) | 481 | nfs4_put_stateowner(struct nfs4_stateowner *so) |
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index d2a8d04428c7..663193b21a24 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h | |||
@@ -351,7 +351,7 @@ struct nfsd4_saved_compoundargs { | |||
351 | 351 | ||
352 | struct nfsd4_test_stateid { | 352 | struct nfsd4_test_stateid { |
353 | __be32 ts_num_ids; | 353 | __be32 ts_num_ids; |
354 | __be32 ts_has_session; | 354 | bool ts_has_session; |
355 | struct nfsd4_compoundargs *ts_saved_args; | 355 | struct nfsd4_compoundargs *ts_saved_args; |
356 | struct nfsd4_saved_compoundargs ts_savedp; | 356 | struct nfsd4_saved_compoundargs ts_savedp; |
357 | }; | 357 | }; |