aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2014-03-08 16:42:05 -0500
committerJ. Bruce Fields <bfields@redhat.com>2014-05-30 17:31:51 -0400
commit67492c990300912c717bc95e9f705feb63de2df9 (patch)
treeab63eda6f32dcb4e72b754b3085341ad243a906f /fs/nfsd/nfs4xdr.c
parent4e21ac4b6f1d09c56f7d10916eaa738361214ab7 (diff)
nfsd4: nfsd4_check_resp_size needn't recalculate length
We're keeping the length updated as we go now, so there's no need for the extra calculation here. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r--fs/nfsd/nfs4xdr.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 8728715cd6e8..89c65a3e09e4 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3752,32 +3752,20 @@ static nfsd4_enc nfsd4_enc_ops[] = {
3752 */ 3752 */
3753__be32 nfsd4_check_resp_size(struct nfsd4_compoundres *resp, u32 pad) 3753__be32 nfsd4_check_resp_size(struct nfsd4_compoundres *resp, u32 pad)
3754{ 3754{
3755 struct xdr_buf *xb = &resp->rqstp->rq_res; 3755 struct xdr_buf *buf = &resp->rqstp->rq_res;
3756 struct nfsd4_session *session = NULL; 3756 struct nfsd4_session *session = NULL;
3757 struct nfsd4_slot *slot = resp->cstate.slot; 3757 struct nfsd4_slot *slot = resp->cstate.slot;
3758 u32 length, tlen = 0;
3759 3758
3760 if (!nfsd4_has_session(&resp->cstate)) 3759 if (!nfsd4_has_session(&resp->cstate))
3761 return 0; 3760 return 0;
3762 3761
3763 session = resp->cstate.session; 3762 session = resp->cstate.session;
3764 3763
3765 if (xb->page_len == 0) { 3764 if (buf->len + pad > session->se_fchannel.maxresp_sz)
3766 length = (char *)resp->xdr.p - (char *)xb->head[0].iov_base + pad;
3767 } else {
3768 if (xb->tail[0].iov_base && xb->tail[0].iov_len > 0)
3769 tlen = (char *)resp->xdr.p - (char *)xb->tail[0].iov_base;
3770
3771 length = xb->head[0].iov_len + xb->page_len + tlen + pad;
3772 }
3773 dprintk("%s length %u, xb->page_len %u tlen %u pad %u\n", __func__,
3774 length, xb->page_len, tlen, pad);
3775
3776 if (length > session->se_fchannel.maxresp_sz)
3777 return nfserr_rep_too_big; 3765 return nfserr_rep_too_big;
3778 3766
3779 if ((slot->sl_flags & NFSD4_SLOT_CACHETHIS) && 3767 if ((slot->sl_flags & NFSD4_SLOT_CACHETHIS) &&
3780 length > session->se_fchannel.maxresp_cached) 3768 buf->len + pad > session->se_fchannel.maxresp_cached)
3781 return nfserr_rep_too_big_to_cache; 3769 return nfserr_rep_too_big_to_cache;
3782 3770
3783 return 0; 3771 return 0;