NFSD: Insulate nfsd4_encode_fattr4() from page boundaries in the encode buffer
authorChuck Lever <chuck.lever@oracle.com>
Tue, 31 Dec 2024 00:28:56 +0000 (19:28 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Sat, 11 Jan 2025 04:43:25 +0000 (23:43 -0500)
commit4163ee711cf141ada9e884a94e6e329431547fd7
tree32a10cbf3bea92ea7705a4b3a787e99c866a7b43
parentb786caa65d4baa73257487e27ebab9004dc768d1
NFSD: Insulate nfsd4_encode_fattr4() from page boundaries in the encode buffer

Commit ab04de60ae1c ("NFSD: Optimize nfsd4_encode_fattr()") replaced
the use of write_bytes_to_xdr_buf() because it's expensive and the
data items to be encoded are already properly aligned.

However, there's no guarantee that the pointer returned from
xdr_reserve_space() will still point to the correct reserved space
in the encode buffer after one or more intervening calls to
xdr_reserve_space(). It just happens to work with the current
implementation of xdr_reserve_space().

This commit effectively reverts the optimization.

Reviewed-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4xdr.c