Commit 65774d49 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd: Make sure final xdr_buf.len is correct on server reply

rq_res->len was not always updated properly.
It is only needed in the sendto routine, so we calculate
it just before that is called, and don't bother
updating it anywhere else.
parent 835a922a
......@@ -616,10 +616,6 @@ nfs3svc_encode_readres(struct svc_rqst *rqstp, u32 *p,
*p = 0;
rqstp->rq_res.tail[0].iov_len = 4 - (resp->count & 3);
}
rqstp->rq_res.len =
rqstp->rq_res.head[0].iov_len+
rqstp->rq_res.page_len+
rqstp->rq_res.tail[0].iov_len;
return 1;
} else
return xdr_ressize_check(rqstp, p);
......@@ -689,9 +685,6 @@ nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p,
*p++ = 0; /* no more entries */
*p++ = htonl(resp->common.err == nfserr_eof);
rqstp->rq_res.page_len = ((unsigned long)p & ~PAGE_MASK);
rqstp->rq_res.len =
rqstp->rq_res.head[0].iov_len+
rqstp->rq_res.page_len;
return 1;
} else
return xdr_ressize_check(rqstp, p);
......
......@@ -397,10 +397,6 @@ nfssvc_encode_readres(struct svc_rqst *rqstp, u32 *p,
*p = 0;
rqstp->rq_res.tail[0].iov_len = 4 - (resp->count&3);
}
rqstp->rq_res.len =
rqstp->rq_res.head[0].iov_len+
rqstp->rq_res.page_len+
rqstp->rq_res.tail[0].iov_len;
return 1;
}
......@@ -413,9 +409,6 @@ nfssvc_encode_readdirres(struct svc_rqst *rqstp, u32 *p,
*p++ = 0; /* no more entries */
*p++ = htonl((resp->common.err == nfserr_eof));
rqstp->rq_res.page_len = ((unsigned long)p & ~PAGE_MASK);
rqstp->rq_res.len =
rqstp->rq_res.head[0].iov_len+
rqstp->rq_res.page_len;
return 1;
}
......
......@@ -167,7 +167,6 @@ xdr_ressize_check(struct svc_rqst *rqstp, u32 *p)
char *cp = (char*)p;
vec->iov_len = cp - (char*)vec->iov_base;
rqstp->rq_res.len = vec->iov_len;
return vec->iov_len <= PAGE_SIZE;
}
......
......@@ -1195,6 +1195,7 @@ svc_send(struct svc_rqst *rqstp)
{
struct svc_sock *svsk;
int len;
struct xdr_buf *xb;
if ((svsk = rqstp->rq_sock) == NULL) {
printk(KERN_WARNING "NULL socket pointer in %s:%d\n",
......@@ -1205,6 +1206,12 @@ svc_send(struct svc_rqst *rqstp)
/* release the receive skb before sending the reply */
svc_release_skb(rqstp);
/* calculate over-all length */
xb = & rqstp->rq_res;
xb->len = xb->head[0].iov_len +
xb->page_len +
xb->tail[0].iov_len;
len = svsk->sk_sendto(rqstp);
svc_sock_release(rqstp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment