OSDN Git Service

svcrdma: Fix byte-swapping in svc_rdma_sendto.c
authorChuck Lever <chuck.lever@oracle.com>
Thu, 4 Jun 2015 15:20:39 +0000 (11:20 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Thu, 4 Jun 2015 20:55:58 +0000 (16:55 -0400)
commit70747c25a701b563a54c20c4a77efe8292aad151
tree166199a6b9e088a745f2334b9ff7f73d1cfd2fde
parent276f03e3ba242ebf2cf201cc3c7058d2884912b7
svcrdma: Fix byte-swapping in svc_rdma_sendto.c

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=248
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
net/sunrpc/xprtrdma/svc_rdma_sendto.c