diff mbox series

[v2,9/9] NFSv4.2: Fix up read_plus() page alignment

Message ID 20201124135025.1097571-10-trondmy@kernel.org (mailing list archive)
State New
Headers show
Series Fix various issues in the SUNRPC xdr code | expand

Commit Message

trondmy@kernel.org Nov. 24, 2020, 1:50 p.m. UTC
From: Trond Myklebust <trond.myklebust@hammerspace.com>

Assume that the first record is a data record, and that we have to read
the 8+4 first bytes of that record before the call to nfs_align_pages().

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/nfs42xdr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c
index 6e060a88f98c..f5abace015d7 100644
--- a/fs/nfs/nfs42xdr.c
+++ b/fs/nfs/nfs42xdr.c
@@ -760,14 +760,16 @@  static void nfs4_xdr_enc_read_plus(struct rpc_rqst *req,
 	struct compound_hdr hdr = {
 		.minorversion = nfs4_xdr_minorversion(&args->seq_args),
 	};
+	unsigned int replen;
 
 	encode_compound_hdr(xdr, req, &hdr);
 	encode_sequence(xdr, &args->seq_args, &hdr);
 	encode_putfh(xdr, args->fh, &hdr);
+	replen = hdr.replen + op_decode_hdr_maxsz + 2 + 1 + 3;
 	encode_read_plus(xdr, args, &hdr);
 
 	rpc_prepare_reply_pages(req, args->pages, args->pgbase,
-				args->count, hdr.replen);
+				args->count, replen);
 	encode_nops(&hdr);
 }