aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs4proc.c2
-rw-r--r--net/sunrpc/xdr.c9
2 files changed, 6 insertions, 5 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index f053c5a9ebf1..6851b003f2a4 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1264,7 +1264,7 @@ static void svcxdr_init_encode(struct svc_rqst *rqstp,
/* Tail and page_len should be zero at this point: */
buf->len = buf->head[0].iov_len;
xdr->scratch.iov_len = 0;
- xdr->page_ptr = buf->pages;
+ xdr->page_ptr = buf->pages - 1;
buf->buflen = PAGE_SIZE * (1 + rqstp->rq_page_end - buf->pages)
- rqstp->rq_auth_slack;
}
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 39928444c7fb..23fb4e75e245 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -523,10 +523,9 @@ __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr, size_t nbytes)
frag2bytes = nbytes - frag1bytes;
if (xdr->iov)
xdr->iov->iov_len += frag1bytes;
- else {
+ else
xdr->buf->page_len += frag1bytes;
- xdr->page_ptr++;
- }
+ xdr->page_ptr++;
xdr->iov = NULL;
/*
* If the last encode didn't end exactly on a page boundary, the
@@ -638,8 +637,10 @@ void xdr_truncate_encode(struct xdr_stream *xdr, size_t len)
/* xdr->iov should already be NULL */
return;
}
- if (fraglen)
+ if (fraglen) {
xdr->end = head->iov_base + head->iov_len;
+ xdr->page_ptr--;
+ }
/* (otherwise assume xdr->end is already set) */
head->iov_len = len;
buf->len = len;