]> git.baikalelectronics.ru Git - kernel.git/commit
SUNRPC/NFSD: Implement xdr_reserve_space_vec()
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 17 Aug 2020 16:53:06 +0000 (12:53 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 25 Sep 2020 22:01:27 +0000 (18:01 -0400)
commitb25cc384b7a71678a41c8f9d9320087d155086c9
tree5513e684750faaaa6cf321498478809d87bf4b67
parentd528b8893e876cd4eb5c4300a39ab2877cf3fc80
SUNRPC/NFSD: Implement xdr_reserve_space_vec()

Reserving space for a large READ payload requires special handling when
reserving space in the xdr buffer pages. One problem we can have is use
of the scratch buffer, which is used to get a pointer to a contiguous
region of data up to PAGE_SIZE. When using the scratch buffer, calls to
xdr_commit_encode() shift the data to it's proper alignment in the xdr
buffer. If we've reserved several pages in a vector, then this could
potentially invalidate earlier pointers and result in incorrect READ
data being sent to the client.

I get around this by looking at the amount of space left in the current
page, and never reserve more than that for each entry in the read
vector. This lets us place data directly where it needs to go in the
buffer pages.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4xdr.c
include/linux/sunrpc/xdr.h
net/sunrpc/xdr.c