aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2011-09-02 16:36:49 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-09-03 23:15:28 -0400
commitf4dee24cca98739a4190a00fa014cd1b7e2581a4 (patch)
treef5d4e151450ac40aabaf8bbd802e37c1b1ec70ef /fs/nfsd/nfs4state.c
parent68b66e8270f44d297a48662e6aed72c5944f77bd (diff)
nfsd4: move CLOSE_STATE special case to caller
Move the CLOSE_STATE case into the unique caller that cares about it rather than putting it in preprocess_seqid_op. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 9c44630a245a..eb11626babc6 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3070,15 +3070,13 @@ laundromat_main(struct work_struct *not_used)
3070} 3070}
3071 3071
3072static struct nfs4_stateowner * 3072static struct nfs4_stateowner *
3073search_close_lru(u32 st_id, int flags) 3073search_close_lru(u32 st_id)
3074{ 3074{
3075 struct nfs4_stateowner *local = NULL; 3075 struct nfs4_stateowner *local;
3076 3076
3077 if (flags & CLOSE_STATE) { 3077 list_for_each_entry(local, &close_lru, so_close_lru) {
3078 list_for_each_entry(local, &close_lru, so_close_lru) { 3078 if (local->so_id == st_id)
3079 if (local->so_id == st_id) 3079 return local;
3080 return local;
3081 }
3082 } 3080 }
3083 return NULL; 3081 return NULL;
3084} 3082}
@@ -3381,7 +3379,6 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
3381 stateid_t *stateid, int flags, 3379 stateid_t *stateid, int flags,
3382 struct nfs4_stateid **stpp) 3380 struct nfs4_stateid **stpp)
3383{ 3381{
3384 struct nfs4_stateid *stp;
3385 struct nfs4_stateowner *sop; 3382 struct nfs4_stateowner *sop;
3386 struct svc_fh *current_fh = &cstate->current_fh; 3383 struct svc_fh *current_fh = &cstate->current_fh;
3387 __be32 status; 3384 __be32 status;
@@ -3404,28 +3401,14 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
3404 * the confirmed flag is incorrecly set, or the generation 3401 * the confirmed flag is incorrecly set, or the generation
3405 * number is incorrect. 3402 * number is incorrect.
3406 */ 3403 */
3407 stp = find_stateid(stateid, flags); 3404 *stpp = find_stateid(stateid, flags);
3408 if (stp == NULL) { 3405 if (*stpp == NULL)
3409 /* 3406 return nfserr_expired;
3410 * Also, we should make sure this isn't just the result of
3411 * a replayed close:
3412 */
3413 sop = search_close_lru(stateid->si_stateownerid, flags);
3414 /* It's not stale; let's assume it's expired: */
3415 if (sop == NULL)
3416 return nfserr_expired;
3417 cstate->replay_owner = sop;
3418 status = nfsd4_check_seqid(cstate, sop, seqid);
3419 if (status)
3420 return status;
3421 return nfserr_bad_seqid;
3422 }
3423 3407
3424 *stpp = stp; 3408 sop = (*stpp)->st_stateowner;
3425 sop = stp->st_stateowner;
3426 cstate->replay_owner = sop; 3409 cstate->replay_owner = sop;
3427 3410
3428 if (nfs4_check_fh(current_fh, stp)) { 3411 if (nfs4_check_fh(current_fh, *stpp)) {
3429 dprintk("NFSD: preprocess_seqid_op: fh-stateid mismatch!\n"); 3412 dprintk("NFSD: preprocess_seqid_op: fh-stateid mismatch!\n");
3430 return nfserr_bad_stateid; 3413 return nfserr_bad_stateid;
3431 } 3414 }
@@ -3439,7 +3422,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
3439 " confirmed yet!\n"); 3422 " confirmed yet!\n");
3440 return nfserr_bad_stateid; 3423 return nfserr_bad_stateid;
3441 } 3424 }
3442 status = check_stateid_generation(stateid, &stp->st_stateid, nfsd4_has_session(cstate)); 3425 status = check_stateid_generation(stateid, &(*stpp)->st_stateid, nfsd4_has_session(cstate));
3443 if (status) 3426 if (status)
3444 return status; 3427 return status;
3445 renew_client(sop->so_client); 3428 renew_client(sop->so_client);
@@ -3574,7 +3557,22 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3574 /* check close_lru for replay */ 3557 /* check close_lru for replay */
3575 status = nfs4_preprocess_seqid_op(cstate, close->cl_seqid, 3558 status = nfs4_preprocess_seqid_op(cstate, close->cl_seqid,
3576 &close->cl_stateid, 3559 &close->cl_stateid,
3577 OPEN_STATE | CLOSE_STATE, &stp); 3560 OPEN_STATE, &stp);
3561 if (stp == NULL && status == nfserr_expired) {
3562 /*
3563 * Also, we should make sure this isn't just the result of
3564 * a replayed close:
3565 */
3566 so = search_close_lru(close->cl_stateid.si_stateownerid);
3567 /* It's not stale; let's assume it's expired: */
3568 if (so == NULL)
3569 goto out;
3570 cstate->replay_owner = so;
3571 status = nfsd4_check_seqid(cstate, so, close->cl_seqid);
3572 if (status)
3573 goto out;
3574 status = nfserr_bad_seqid;
3575 }
3578 if (status) 3576 if (status)
3579 goto out; 3577 goto out;
3580 so = stp->st_stateowner; 3578 so = stp->st_stateowner;