mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
NFSv4.2: Fix READ_PLUS size calculations
[ Upstream commit8d18f6c5bb] I bump the decode_read_plus_maxsz to account for hole segments, but I need to subtract out this increase when calling rpc_prepare_reply_pages() so the common case of single data segment replies can be directly placed into the xdr pages without needing to be shifted around. Reported-by: Chuck Lever <chuck.lever@oracle.com> Fixes:d3b00a802c("NFS: Replace the READ_PLUS decoding code") Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fccdafa51d
commit
18d51547fe
@@ -51,10 +51,16 @@
|
|||||||
(1 /* data_content4 */ + \
|
(1 /* data_content4 */ + \
|
||||||
2 /* data_info4.di_offset */ + \
|
2 /* data_info4.di_offset */ + \
|
||||||
1 /* data_info4.di_length */)
|
1 /* data_info4.di_length */)
|
||||||
|
#define NFS42_READ_PLUS_HOLE_SEGMENT_SIZE \
|
||||||
|
(1 /* data_content4 */ + \
|
||||||
|
2 /* data_info4.di_offset */ + \
|
||||||
|
2 /* data_info4.di_length */)
|
||||||
|
#define READ_PLUS_SEGMENT_SIZE_DIFF (NFS42_READ_PLUS_HOLE_SEGMENT_SIZE - \
|
||||||
|
NFS42_READ_PLUS_DATA_SEGMENT_SIZE)
|
||||||
#define decode_read_plus_maxsz (op_decode_hdr_maxsz + \
|
#define decode_read_plus_maxsz (op_decode_hdr_maxsz + \
|
||||||
1 /* rpr_eof */ + \
|
1 /* rpr_eof */ + \
|
||||||
1 /* rpr_contents count */ + \
|
1 /* rpr_contents count */ + \
|
||||||
NFS42_READ_PLUS_DATA_SEGMENT_SIZE)
|
NFS42_READ_PLUS_HOLE_SEGMENT_SIZE)
|
||||||
#define encode_seek_maxsz (op_encode_hdr_maxsz + \
|
#define encode_seek_maxsz (op_encode_hdr_maxsz + \
|
||||||
encode_stateid_maxsz + \
|
encode_stateid_maxsz + \
|
||||||
2 /* offset */ + \
|
2 /* offset */ + \
|
||||||
@@ -781,8 +787,8 @@ static void nfs4_xdr_enc_read_plus(struct rpc_rqst *req,
|
|||||||
encode_putfh(xdr, args->fh, &hdr);
|
encode_putfh(xdr, args->fh, &hdr);
|
||||||
encode_read_plus(xdr, args, &hdr);
|
encode_read_plus(xdr, args, &hdr);
|
||||||
|
|
||||||
rpc_prepare_reply_pages(req, args->pages, args->pgbase,
|
rpc_prepare_reply_pages(req, args->pages, args->pgbase, args->count,
|
||||||
args->count, hdr.replen);
|
hdr.replen - READ_PLUS_SEGMENT_SIZE_DIFF);
|
||||||
encode_nops(&hdr);
|
encode_nops(&hdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user