• Chuck Lever's avatar
    xprtrdma: Allow Read list and Reply chunk simultaneously · 94f58c58
    Chuck Lever authored
    rpcrdma_marshal_req() makes a simplifying assumption: that NFS
    operations with large Call messages have small Reply messages, and
    vice versa. Therefore with RPC-over-RDMA, only one chunk type is
    ever needed for each Call/Reply pair, because one direction needs
    chunks, the other direction will always fit inline.
    
    In fact, this assumption is asserted in the code:
    
      if (rtype != rpcrdma_noch && wtype != rpcrdma_noch) {
      	dprintk("RPC:       %s: cannot marshal multiple chunk lists\n",
    		__func__);
    	return -EIO;
      }
    
    But RPCGSS_SEC breaks this assumption. Because krb5i and krb5p
    perform data transformation on RPC messages before they are
    transmitted, direct data placement techniques cannot be used, thus
    RPC messages must be sent via a Long call in both directions.
    All such calls are sent with a Position Zero Read chunk, and all
    such replies are handled with a Reply chunk. Thus the client must
    provide every Call/Reply pair with both a Read list and a Reply
    chunk.
    
    Without any special security in effect, NFSv4 WRITEs may now also
    use the Read list and provide a Reply chunk. The marshal_req
    logic was preventing that, meaning an NFSv4 WRITE with a large
    payload that included a GETATTR result larger than the inline
    threshold would fail.
    
    The code that encodes each chunk list is now completely contained in
    its own function. There is some code duplication, but the trade-off
    is that the overall logic should be more clear.
    
    Note that all three chunk lists now share the rl_segments array.
    Some additional per-req accounting is necessary to track this
    usage. For the same reasons that the above simplifying assumption
    has held true for so long, I don't expect more array elements are
    needed at this time.
    Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    Tested-by: default avatarSteve Wise <swise@opengridcomputing.com>
    Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
    Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
    94f58c58
rpc_rdma.c 37.1 KB