• Chuck Lever's avatar
    svcrdma: Fix byte-swapping in svc_rdma_sendto.c · 70747c25
    Chuck Lever authored
    In send_write_chunks(), we have:
    
    	for (xdr_off = rqstp->rq_res.head[0].iov_len, chunk_no = 0;
    	     xfer_len && chunk_no < arg_ary->wc_nchunks;
    	     chunk_no++) {
    		 . . .
    	}
    
    Note that arg_ary->wc_nchunk is in network byte-order. For the
    comparison to work correctly, both have to be in native byte-order.
    
    In send_reply_chunks, we have:
    
    	write_len = min(xfer_len, htonl(ch->rs_length));
    
    xfer_len is in native byte-order, and ch->rs_length is in
    network byte-order. be32_to_cpu() is the correct byte swap
    for ch->rs_length.
    
    As an additional clean up, replace ntohl() with be32_to_cpu() in
    a few other places.
    
    This appears to address a problem with large rsize hangs while
    using PHYSICAL memory registration. I suspect that is the only
    registration mode that uses more than one chunk element.
    
    BugLink: https://bugzilla.linux-nfs.org/show_bug.cgi?id=248Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
    70747c25
svc_rdma_sendto.c 15.9 KB