• Chuck Lever's avatar
    svcrdma: Properly compute .len and .buflen for received RPC Calls · 71641d99
    Chuck Lever authored
    When an RPC-over-RDMA request is received, the Receive buffer
    contains a Transport Header possibly followed by an RPC message.
    
    Even though rq_arg.head[0] (as passed to NFSD) does not contain the
    Transport Header header, currently rq_arg.len includes the size of
    the Transport Header.
    
    That violates the intent of the xdr_buf API contract. .buflen should
    include everything, but .len should be exactly the length of the RPC
    message in the buffer.
    
    The rq_arg fields are summed together at the end of
    svc_rdma_recvfrom to obtain the correct return value. rq_arg.len
    really ought to contain the correct number of bytes already, but it
    currently doesn't due to the above misbehavior.
    
    Let's instead ensure that .buflen includes the length of the
    transport header, and that .len is always equal to head.iov_len +
    .page_len + tail.iov_len .
    Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
    71641d99
svc_rdma_recvfrom.c 16.5 KB