• Anna Schumaker's avatar
    SUNRPC/NFSD: Implement xdr_reserve_space_vec() · 403217f3
    Anna Schumaker authored
    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: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
    403217f3
xdr.c 42.7 KB