• Chuck Lever's avatar
    xprtrdma: Per-connection pad optimization · b5f0afbe
    Chuck Lever authored
    Pad optimization is changed by echoing into
    /proc/sys/sunrpc/rdma_pad_optimize. This is a global setting,
    affecting all RPC-over-RDMA connections to all servers.
    
    The marshaling code picks up that value and uses it for decisions
    about how to construct each RPC-over-RDMA frame. Having it change
    suddenly in mid-operation can result in unexpected failures. And
    some servers a client mounts might need chunk round-up, while
    others don't.
    
    So instead, copy the pad_optimize setting into each connection's
    rpcrdma_ia when the transport is created, and use the copy, which
    can't change during the life of the connection, instead.
    
    This also removes a hack: rpcrdma_convert_iovs was using
    the remote-invalidation-expected flag to predict when it could leave
    out Write chunk padding. This is because the Linux server handles
    implicit XDR padding on Write chunks correctly, and only Linux
    servers can set the connection's remote-invalidation-expected flag.
    
    It's more sensible to use the pad optimization setting instead.
    
    Fixes: 677eb17e ("xprtrdma: Fix XDR tail buffer marshalling")
    Cc: stable@vger.kernel.org # v4.9+
    Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
    b5f0afbe
rpc_rdma.c 33.3 KB