aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4proc.c10
-rw-r--r--fs/nfsd/nfs4state.c22
2 files changed, 18 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index ae21a4efe36c..e6a0f314fdbe 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -513,9 +513,8 @@ nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
513 513
514 nfs4_lock_state(); 514 nfs4_lock_state();
515 /* check stateid */ 515 /* check stateid */
516 if ((status = nfs4_preprocess_stateid_op(&cstate->current_fh, 516 if ((status = nfs4_preprocess_stateid_op(cstate, &read->rd_stateid,
517 &read->rd_stateid, 517 RD_STATE, &read->rd_filp))) {
518 RD_STATE, &read->rd_filp))) {
519 dprintk("NFSD: nfsd4_read: couldn't process stateid!\n"); 518 dprintk("NFSD: nfsd4_read: couldn't process stateid!\n");
520 goto out; 519 goto out;
521 } 520 }
@@ -646,7 +645,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
646 645
647 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { 646 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
648 nfs4_lock_state(); 647 nfs4_lock_state();
649 status = nfs4_preprocess_stateid_op(&cstate->current_fh, 648 status = nfs4_preprocess_stateid_op(cstate,
650 &setattr->sa_stateid, WR_STATE, NULL); 649 &setattr->sa_stateid, WR_STATE, NULL);
651 nfs4_unlock_state(); 650 nfs4_unlock_state();
652 if (status) { 651 if (status) {
@@ -686,8 +685,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
686 return nfserr_inval; 685 return nfserr_inval;
687 686
688 nfs4_lock_state(); 687 nfs4_lock_state();
689 status = nfs4_preprocess_stateid_op(&cstate->current_fh, stateid, 688 status = nfs4_preprocess_stateid_op(cstate, stateid, WR_STATE, &filp);
690 WR_STATE, &filp);
691 if (filp) 689 if (filp)
692 get_file(filp); 690 get_file(filp);
693 nfs4_unlock_state(); 691 nfs4_unlock_state();
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 9192e5b35f42..f49f305096ec 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2810,10 +2810,12 @@ static int is_delegation_stateid(stateid_t *stateid)
2810* Checks for stateid operations 2810* Checks for stateid operations
2811*/ 2811*/
2812__be32 2812__be32
2813nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int flags, struct file **filpp) 2813nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
2814 stateid_t *stateid, int flags, struct file **filpp)
2814{ 2815{
2815 struct nfs4_stateid *stp = NULL; 2816 struct nfs4_stateid *stp = NULL;
2816 struct nfs4_delegation *dp = NULL; 2817 struct nfs4_delegation *dp = NULL;
2818 struct svc_fh *current_fh = &cstate->current_fh;
2817 struct inode *ino = current_fh->fh_dentry->d_inode; 2819 struct inode *ino = current_fh->fh_dentry->d_inode;
2818 __be32 status; 2820 __be32 status;
2819 2821
@@ -2878,10 +2880,14 @@ setlkflg (int type)
2878 * Checks for sequence id mutating operations. 2880 * Checks for sequence id mutating operations.
2879 */ 2881 */
2880static __be32 2882static __be32
2881nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, struct nfsd4_lock *lock) 2883nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
2884 stateid_t *stateid, int flags,
2885 struct nfs4_stateowner **sopp,
2886 struct nfs4_stateid **stpp, struct nfsd4_lock *lock)
2882{ 2887{
2883 struct nfs4_stateid *stp; 2888 struct nfs4_stateid *stp;
2884 struct nfs4_stateowner *sop; 2889 struct nfs4_stateowner *sop;
2890 struct svc_fh *current_fh = &cstate->current_fh;
2885 __be32 status; 2891 __be32 status;
2886 2892
2887 dprintk("NFSD: preprocess_seqid_op: seqid=%d " 2893 dprintk("NFSD: preprocess_seqid_op: seqid=%d "
@@ -3004,7 +3010,7 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3004 3010
3005 nfs4_lock_state(); 3011 nfs4_lock_state();
3006 3012
3007 if ((status = nfs4_preprocess_seqid_op(&cstate->current_fh, 3013 if ((status = nfs4_preprocess_seqid_op(cstate,
3008 oc->oc_seqid, &oc->oc_req_stateid, 3014 oc->oc_seqid, &oc->oc_req_stateid,
3009 CONFIRM | OPEN_STATE, 3015 CONFIRM | OPEN_STATE,
3010 &oc->oc_stateowner, &stp, NULL))) 3016 &oc->oc_stateowner, &stp, NULL)))
@@ -3074,7 +3080,7 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp,
3074 return nfserr_inval; 3080 return nfserr_inval;
3075 3081
3076 nfs4_lock_state(); 3082 nfs4_lock_state();
3077 if ((status = nfs4_preprocess_seqid_op(&cstate->current_fh, 3083 if ((status = nfs4_preprocess_seqid_op(cstate,
3078 od->od_seqid, 3084 od->od_seqid,
3079 &od->od_stateid, 3085 &od->od_stateid,
3080 OPEN_STATE, 3086 OPEN_STATE,
@@ -3127,7 +3133,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3127 3133
3128 nfs4_lock_state(); 3134 nfs4_lock_state();
3129 /* check close_lru for replay */ 3135 /* check close_lru for replay */
3130 if ((status = nfs4_preprocess_seqid_op(&cstate->current_fh, 3136 if ((status = nfs4_preprocess_seqid_op(cstate,
3131 close->cl_seqid, 3137 close->cl_seqid,
3132 &close->cl_stateid, 3138 &close->cl_stateid,
3133 OPEN_STATE | CLOSE_STATE, 3139 OPEN_STATE | CLOSE_STATE,
@@ -3474,7 +3480,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3474 goto out; 3480 goto out;
3475 3481
3476 /* validate and update open stateid and open seqid */ 3482 /* validate and update open stateid and open seqid */
3477 status = nfs4_preprocess_seqid_op(&cstate->current_fh, 3483 status = nfs4_preprocess_seqid_op(cstate,
3478 lock->lk_new_open_seqid, 3484 lock->lk_new_open_seqid,
3479 &lock->lk_new_open_stateid, 3485 &lock->lk_new_open_stateid,
3480 OPEN_STATE, 3486 OPEN_STATE,
@@ -3501,7 +3507,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3501 goto out; 3507 goto out;
3502 } else { 3508 } else {
3503 /* lock (lock owner + lock stateid) already exists */ 3509 /* lock (lock owner + lock stateid) already exists */
3504 status = nfs4_preprocess_seqid_op(&cstate->current_fh, 3510 status = nfs4_preprocess_seqid_op(cstate,
3505 lock->lk_old_lock_seqid, 3511 lock->lk_old_lock_seqid,
3506 &lock->lk_old_lock_stateid, 3512 &lock->lk_old_lock_stateid,
3507 LOCK_STATE, 3513 LOCK_STATE,
@@ -3697,7 +3703,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3697 3703
3698 nfs4_lock_state(); 3704 nfs4_lock_state();
3699 3705
3700 if ((status = nfs4_preprocess_seqid_op(&cstate->current_fh, 3706 if ((status = nfs4_preprocess_seqid_op(cstate,
3701 locku->lu_seqid, 3707 locku->lu_seqid,
3702 &locku->lu_stateid, 3708 &locku->lu_stateid,
3703 LOCK_STATE, 3709 LOCK_STATE,