aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2014-04-18 14:44:07 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-05-07 11:05:48 -0400
commit14bcab1a395b1b150e654100cce09a1b552ec5f1 (patch)
tree709b87c167c18c446b5ad73dacb11f80aabe6e3c /fs/nfsd/nfs4proc.c
parent50cc62317dece5173b56aa8d3569930b065ce47d (diff)
NFSd: Clean up nfs4_preprocess_stateid_op
Move the state locking and file descriptor reference out from the callers and into nfs4_preprocess_stateid_op() itself. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4proc.c')
-rw-r--r--fs/nfsd/nfs4proc.c11
1 files changed, 0 insertions, 11 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index d543222babf3..ac837783b37d 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -786,7 +786,6 @@ nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
786 if (!nfsd4_last_compound_op(rqstp)) 786 if (!nfsd4_last_compound_op(rqstp))
787 rqstp->rq_splice_ok = false; 787 rqstp->rq_splice_ok = false;
788 788
789 nfs4_lock_state();
790 /* check stateid */ 789 /* check stateid */
791 if ((status = nfs4_preprocess_stateid_op(SVC_NET(rqstp), 790 if ((status = nfs4_preprocess_stateid_op(SVC_NET(rqstp),
792 cstate, &read->rd_stateid, 791 cstate, &read->rd_stateid,
@@ -794,11 +793,8 @@ nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
794 dprintk("NFSD: nfsd4_read: couldn't process stateid!\n"); 793 dprintk("NFSD: nfsd4_read: couldn't process stateid!\n");
795 goto out; 794 goto out;
796 } 795 }
797 if (read->rd_filp)
798 get_file(read->rd_filp);
799 status = nfs_ok; 796 status = nfs_ok;
800out: 797out:
801 nfs4_unlock_state();
802 read->rd_rqstp = rqstp; 798 read->rd_rqstp = rqstp;
803 read->rd_fhp = &cstate->current_fh; 799 read->rd_fhp = &cstate->current_fh;
804 return status; 800 return status;
@@ -937,10 +933,8 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
937 int err; 933 int err;
938 934
939 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { 935 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
940 nfs4_lock_state();
941 status = nfs4_preprocess_stateid_op(SVC_NET(rqstp), cstate, 936 status = nfs4_preprocess_stateid_op(SVC_NET(rqstp), cstate,
942 &setattr->sa_stateid, WR_STATE, NULL); 937 &setattr->sa_stateid, WR_STATE, NULL);
943 nfs4_unlock_state();
944 if (status) { 938 if (status) {
945 dprintk("NFSD: nfsd4_setattr: couldn't process stateid!\n"); 939 dprintk("NFSD: nfsd4_setattr: couldn't process stateid!\n");
946 return status; 940 return status;
@@ -1006,17 +1000,12 @@ nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1006 if (write->wr_offset >= OFFSET_MAX) 1000 if (write->wr_offset >= OFFSET_MAX)
1007 return nfserr_inval; 1001 return nfserr_inval;
1008 1002
1009 nfs4_lock_state();
1010 status = nfs4_preprocess_stateid_op(SVC_NET(rqstp), 1003 status = nfs4_preprocess_stateid_op(SVC_NET(rqstp),
1011 cstate, stateid, WR_STATE, &filp); 1004 cstate, stateid, WR_STATE, &filp);
1012 if (status) { 1005 if (status) {
1013 nfs4_unlock_state();
1014 dprintk("NFSD: nfsd4_write: couldn't process stateid!\n"); 1006 dprintk("NFSD: nfsd4_write: couldn't process stateid!\n");
1015 return status; 1007 return status;
1016 } 1008 }
1017 if (filp)
1018 get_file(filp);
1019 nfs4_unlock_state();
1020 1009
1021 cnt = write->wr_buflen; 1010 cnt = write->wr_buflen;
1022 write->wr_how_written = write->wr_stable_how; 1011 write->wr_how_written = write->wr_stable_how;