diff options
-rw-r--r-- | fs/nfsd/nfs4state.c | 57 | ||||
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 5 | ||||
-rw-r--r-- | fs/nfsd/xdr4.h | 7 |
3 files changed, 24 insertions, 45 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index e4535ff92876..bc1a9dbc289c 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -3388,7 +3388,6 @@ setlkflg (int type) | |||
3388 | static __be32 | 3388 | static __be32 |
3389 | nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | 3389 | nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, |
3390 | stateid_t *stateid, int flags, | 3390 | stateid_t *stateid, int flags, |
3391 | struct nfs4_stateowner **sopp, | ||
3392 | struct nfs4_stateid **stpp) | 3391 | struct nfs4_stateid **stpp) |
3393 | { | 3392 | { |
3394 | struct nfs4_stateid *stp; | 3393 | struct nfs4_stateid *stp; |
@@ -3400,7 +3399,6 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | |||
3400 | seqid, STATEID_VAL(stateid)); | 3399 | seqid, STATEID_VAL(stateid)); |
3401 | 3400 | ||
3402 | *stpp = NULL; | 3401 | *stpp = NULL; |
3403 | *sopp = NULL; | ||
3404 | 3402 | ||
3405 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) { | 3403 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) { |
3406 | dprintk("NFSD: preprocess_seqid_op: magic stateid!\n"); | 3404 | dprintk("NFSD: preprocess_seqid_op: magic stateid!\n"); |
@@ -3431,7 +3429,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | |||
3431 | } | 3429 | } |
3432 | 3430 | ||
3433 | *stpp = stp; | 3431 | *stpp = stp; |
3434 | *sopp = sop = stp->st_stateowner; | 3432 | sop = stp->st_stateowner; |
3435 | nfs4_get_stateowner(sop); | 3433 | nfs4_get_stateowner(sop); |
3436 | cstate->replay_owner = sop; | 3434 | cstate->replay_owner = sop; |
3437 | 3435 | ||
@@ -3467,7 +3465,6 @@ check_replay: | |||
3467 | } | 3465 | } |
3468 | dprintk("NFSD: preprocess_seqid_op: bad seqid (expected %d, got %d)\n", | 3466 | dprintk("NFSD: preprocess_seqid_op: bad seqid (expected %d, got %d)\n", |
3469 | sop->so_seqid, seqid); | 3467 | sop->so_seqid, seqid); |
3470 | *sopp = NULL; | ||
3471 | return nfserr_bad_seqid; | 3468 | return nfserr_bad_seqid; |
3472 | } | 3469 | } |
3473 | 3470 | ||
@@ -3489,13 +3486,13 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3489 | 3486 | ||
3490 | nfs4_lock_state(); | 3487 | nfs4_lock_state(); |
3491 | 3488 | ||
3492 | if ((status = nfs4_preprocess_seqid_op(cstate, | 3489 | status = nfs4_preprocess_seqid_op(cstate, |
3493 | oc->oc_seqid, &oc->oc_req_stateid, | 3490 | oc->oc_seqid, &oc->oc_req_stateid, |
3494 | CONFIRM | OPEN_STATE, | 3491 | CONFIRM | OPEN_STATE, &stp); |
3495 | &oc->oc_stateowner, &stp))) | 3492 | if (status) |
3496 | goto out; | 3493 | goto out; |
3497 | 3494 | ||
3498 | sop = oc->oc_stateowner; | 3495 | sop = stp->st_stateowner; |
3499 | sop->so_confirmed = 1; | 3496 | sop->so_confirmed = 1; |
3500 | update_stateid(&stp->st_stateid); | 3497 | update_stateid(&stp->st_stateid); |
3501 | memcpy(&oc->oc_resp_stateid, &stp->st_stateid, sizeof(stateid_t)); | 3498 | memcpy(&oc->oc_resp_stateid, &stp->st_stateid, sizeof(stateid_t)); |
@@ -3547,11 +3544,9 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, | |||
3547 | return nfserr_inval; | 3544 | return nfserr_inval; |
3548 | 3545 | ||
3549 | nfs4_lock_state(); | 3546 | nfs4_lock_state(); |
3550 | if ((status = nfs4_preprocess_seqid_op(cstate, | 3547 | status = nfs4_preprocess_seqid_op(cstate, od->od_seqid, |
3551 | od->od_seqid, | 3548 | &od->od_stateid, OPEN_STATE, &stp); |
3552 | &od->od_stateid, | 3549 | if (status) |
3553 | OPEN_STATE, | ||
3554 | &od->od_stateowner, &stp))) | ||
3555 | goto out; | 3550 | goto out; |
3556 | 3551 | ||
3557 | status = nfserr_inval; | 3552 | status = nfserr_inval; |
@@ -3586,6 +3581,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3586 | { | 3581 | { |
3587 | __be32 status; | 3582 | __be32 status; |
3588 | struct nfs4_stateid *stp; | 3583 | struct nfs4_stateid *stp; |
3584 | struct nfs4_stateowner *so; | ||
3589 | 3585 | ||
3590 | dprintk("NFSD: nfsd4_close on file %.*s\n", | 3586 | dprintk("NFSD: nfsd4_close on file %.*s\n", |
3591 | (int)cstate->current_fh.fh_dentry->d_name.len, | 3587 | (int)cstate->current_fh.fh_dentry->d_name.len, |
@@ -3593,12 +3589,12 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3593 | 3589 | ||
3594 | nfs4_lock_state(); | 3590 | nfs4_lock_state(); |
3595 | /* check close_lru for replay */ | 3591 | /* check close_lru for replay */ |
3596 | if ((status = nfs4_preprocess_seqid_op(cstate, | 3592 | status = nfs4_preprocess_seqid_op(cstate, close->cl_seqid, |
3597 | close->cl_seqid, | ||
3598 | &close->cl_stateid, | 3593 | &close->cl_stateid, |
3599 | OPEN_STATE | CLOSE_STATE, | 3594 | OPEN_STATE | CLOSE_STATE, &stp); |
3600 | &close->cl_stateowner, &stp))) | 3595 | if (status) |
3601 | goto out; | 3596 | goto out; |
3597 | so = stp->st_stateowner; | ||
3602 | status = nfs_ok; | 3598 | status = nfs_ok; |
3603 | update_stateid(&stp->st_stateid); | 3599 | update_stateid(&stp->st_stateid); |
3604 | memcpy(&close->cl_stateid, &stp->st_stateid, sizeof(stateid_t)); | 3600 | memcpy(&close->cl_stateid, &stp->st_stateid, sizeof(stateid_t)); |
@@ -3610,8 +3606,8 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3610 | * released by the laundromat service after the lease period | 3606 | * released by the laundromat service after the lease period |
3611 | * to enable us to handle CLOSE replay | 3607 | * to enable us to handle CLOSE replay |
3612 | */ | 3608 | */ |
3613 | if (list_empty(&close->cl_stateowner->so_stateids)) | 3609 | if (list_empty(&so->so_stateids)) |
3614 | move_to_close_lru(close->cl_stateowner); | 3610 | move_to_close_lru(so); |
3615 | out: | 3611 | out: |
3616 | nfs4_unlock_state(); | 3612 | nfs4_unlock_state(); |
3617 | return status; | 3613 | return status; |
@@ -3962,12 +3958,11 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3962 | status = nfs4_preprocess_seqid_op(cstate, | 3958 | status = nfs4_preprocess_seqid_op(cstate, |
3963 | lock->lk_new_open_seqid, | 3959 | lock->lk_new_open_seqid, |
3964 | &lock->lk_new_open_stateid, | 3960 | &lock->lk_new_open_stateid, |
3965 | OPEN_STATE, | 3961 | OPEN_STATE, &open_stp); |
3966 | &lock->lk_replay_owner, &open_stp); | ||
3967 | if (status) | 3962 | if (status) |
3968 | goto out; | 3963 | goto out; |
3969 | status = nfserr_bad_stateid; | 3964 | status = nfserr_bad_stateid; |
3970 | open_sop = lock->lk_replay_owner; | 3965 | open_sop = open_stp->st_stateowner; |
3971 | if (!nfsd4_has_session(cstate) && | 3966 | if (!nfsd4_has_session(cstate) && |
3972 | !same_clid(&open_sop->so_client->cl_clientid, | 3967 | !same_clid(&open_sop->so_client->cl_clientid, |
3973 | &lock->v.new.clientid)) | 3968 | &lock->v.new.clientid)) |
@@ -3993,14 +3988,13 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3993 | status = nfs4_preprocess_seqid_op(cstate, | 3988 | status = nfs4_preprocess_seqid_op(cstate, |
3994 | lock->lk_old_lock_seqid, | 3989 | lock->lk_old_lock_seqid, |
3995 | &lock->lk_old_lock_stateid, | 3990 | &lock->lk_old_lock_stateid, |
3996 | LOCK_STATE, | 3991 | LOCK_STATE, &lock_stp); |
3997 | &lock->lk_replay_owner, &lock_stp); | ||
3998 | if (status) | 3992 | if (status) |
3999 | goto out; | 3993 | goto out; |
4000 | lock_sop = lock->lk_replay_owner; | 3994 | lock_sop = lock_stp->st_stateowner; |
4001 | fp = lock_stp->st_file; | 3995 | fp = lock_stp->st_file; |
4002 | } | 3996 | } |
4003 | /* lock->lk_replay_owner and lock_stp have been created or found */ | 3997 | /* lock_sop and lock_stp have been created or found */ |
4004 | 3998 | ||
4005 | lkflg = setlkflg(lock->lk_type); | 3999 | lkflg = setlkflg(lock->lk_type); |
4006 | status = nfs4_check_openmode(lock_stp, lkflg); | 4000 | status = nfs4_check_openmode(lock_stp, lkflg); |
@@ -4191,13 +4185,10 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
4191 | 4185 | ||
4192 | nfs4_lock_state(); | 4186 | nfs4_lock_state(); |
4193 | 4187 | ||
4194 | if ((status = nfs4_preprocess_seqid_op(cstate, | 4188 | status = nfs4_preprocess_seqid_op(cstate, locku->lu_seqid, |
4195 | locku->lu_seqid, | 4189 | &locku->lu_stateid, LOCK_STATE, &stp); |
4196 | &locku->lu_stateid, | 4190 | if (status) |
4197 | LOCK_STATE, | ||
4198 | &locku->lu_stateowner, &stp))) | ||
4199 | goto out; | 4191 | goto out; |
4200 | |||
4201 | filp = find_any_file(stp->st_file); | 4192 | filp = find_any_file(stp->st_file); |
4202 | if (!filp) { | 4193 | if (!filp) { |
4203 | status = nfserr_lock_range; | 4194 | status = nfserr_lock_range; |
@@ -4206,7 +4197,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
4206 | BUG_ON(!filp); | 4197 | BUG_ON(!filp); |
4207 | locks_init_lock(&file_lock); | 4198 | locks_init_lock(&file_lock); |
4208 | file_lock.fl_type = F_UNLCK; | 4199 | file_lock.fl_type = F_UNLCK; |
4209 | file_lock.fl_owner = (fl_owner_t) locku->lu_stateowner; | 4200 | file_lock.fl_owner = (fl_owner_t) stp->st_stateowner; |
4210 | file_lock.fl_pid = current->tgid; | 4201 | file_lock.fl_pid = current->tgid; |
4211 | file_lock.fl_file = filp; | 4202 | file_lock.fl_file = filp; |
4212 | file_lock.fl_flags = FL_POSIX; | 4203 | file_lock.fl_flags = FL_POSIX; |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index ee1267838719..462c6eff8471 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -456,7 +456,6 @@ nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close) | |||
456 | { | 456 | { |
457 | DECODE_HEAD; | 457 | DECODE_HEAD; |
458 | 458 | ||
459 | close->cl_stateowner = NULL; | ||
460 | READ_BUF(4); | 459 | READ_BUF(4); |
461 | READ32(close->cl_seqid); | 460 | READ32(close->cl_seqid); |
462 | return nfsd4_decode_stateid(argp, &close->cl_stateid); | 461 | return nfsd4_decode_stateid(argp, &close->cl_stateid); |
@@ -551,7 +550,6 @@ nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock) | |||
551 | { | 550 | { |
552 | DECODE_HEAD; | 551 | DECODE_HEAD; |
553 | 552 | ||
554 | lock->lk_replay_owner = NULL; | ||
555 | /* | 553 | /* |
556 | * type, reclaim(boolean), offset, length, new_lock_owner(boolean) | 554 | * type, reclaim(boolean), offset, length, new_lock_owner(boolean) |
557 | */ | 555 | */ |
@@ -611,7 +609,6 @@ nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku) | |||
611 | { | 609 | { |
612 | DECODE_HEAD; | 610 | DECODE_HEAD; |
613 | 611 | ||
614 | locku->lu_stateowner = NULL; | ||
615 | READ_BUF(8); | 612 | READ_BUF(8); |
616 | READ32(locku->lu_type); | 613 | READ32(locku->lu_type); |
617 | if ((locku->lu_type < NFS4_READ_LT) || (locku->lu_type > NFS4_WRITEW_LT)) | 614 | if ((locku->lu_type < NFS4_READ_LT) || (locku->lu_type > NFS4_WRITEW_LT)) |
@@ -739,7 +736,6 @@ nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_con | |||
739 | { | 736 | { |
740 | DECODE_HEAD; | 737 | DECODE_HEAD; |
741 | 738 | ||
742 | open_conf->oc_stateowner = NULL; | ||
743 | status = nfsd4_decode_stateid(argp, &open_conf->oc_req_stateid); | 739 | status = nfsd4_decode_stateid(argp, &open_conf->oc_req_stateid); |
744 | if (status) | 740 | if (status) |
745 | return status; | 741 | return status; |
@@ -754,7 +750,6 @@ nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_d | |||
754 | { | 750 | { |
755 | DECODE_HEAD; | 751 | DECODE_HEAD; |
756 | 752 | ||
757 | open_down->od_stateowner = NULL; | ||
758 | status = nfsd4_decode_stateid(argp, &open_down->od_stateid); | 753 | status = nfsd4_decode_stateid(argp, &open_down->od_stateid); |
759 | if (status) | 754 | if (status) |
760 | return status; | 755 | return status; |
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index 663193b21a24..341f0a17d217 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h | |||
@@ -81,7 +81,6 @@ struct nfsd4_access { | |||
81 | struct nfsd4_close { | 81 | struct nfsd4_close { |
82 | u32 cl_seqid; /* request */ | 82 | u32 cl_seqid; /* request */ |
83 | stateid_t cl_stateid; /* request+response */ | 83 | stateid_t cl_stateid; /* request+response */ |
84 | struct nfs4_stateowner * cl_stateowner; /* response */ | ||
85 | }; | 84 | }; |
86 | 85 | ||
87 | struct nfsd4_commit { | 86 | struct nfsd4_commit { |
@@ -165,9 +164,6 @@ struct nfsd4_lock { | |||
165 | } ok; | 164 | } ok; |
166 | struct nfsd4_lock_denied denied; | 165 | struct nfsd4_lock_denied denied; |
167 | } u; | 166 | } u; |
168 | /* The lk_replay_owner is the open owner in the open_to_lock_owner | ||
169 | * case and the lock owner otherwise: */ | ||
170 | struct nfs4_stateowner *lk_replay_owner; | ||
171 | }; | 167 | }; |
172 | #define lk_new_open_seqid v.new.open_seqid | 168 | #define lk_new_open_seqid v.new.open_seqid |
173 | #define lk_new_open_stateid v.new.open_stateid | 169 | #define lk_new_open_stateid v.new.open_stateid |
@@ -199,7 +195,6 @@ struct nfsd4_locku { | |||
199 | stateid_t lu_stateid; | 195 | stateid_t lu_stateid; |
200 | u64 lu_offset; | 196 | u64 lu_offset; |
201 | u64 lu_length; | 197 | u64 lu_length; |
202 | struct nfs4_stateowner *lu_stateowner; | ||
203 | }; | 198 | }; |
204 | 199 | ||
205 | 200 | ||
@@ -243,7 +238,6 @@ struct nfsd4_open_confirm { | |||
243 | stateid_t oc_req_stateid /* request */; | 238 | stateid_t oc_req_stateid /* request */; |
244 | u32 oc_seqid /* request */; | 239 | u32 oc_seqid /* request */; |
245 | stateid_t oc_resp_stateid /* response */; | 240 | stateid_t oc_resp_stateid /* response */; |
246 | struct nfs4_stateowner * oc_stateowner; /* response */ | ||
247 | }; | 241 | }; |
248 | 242 | ||
249 | struct nfsd4_open_downgrade { | 243 | struct nfsd4_open_downgrade { |
@@ -251,7 +245,6 @@ struct nfsd4_open_downgrade { | |||
251 | u32 od_seqid; | 245 | u32 od_seqid; |
252 | u32 od_share_access; | 246 | u32 od_share_access; |
253 | u32 od_share_deny; | 247 | u32 od_share_deny; |
254 | struct nfs4_stateowner *od_stateowner; | ||
255 | }; | 248 | }; |
256 | 249 | ||
257 | 250 | ||