From 56450b818756a762c925c76f8c6218ea1c5f7efe Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Mon, 1 Nov 2010 01:25:03 +0000 Subject: rpc-transport/rdma: increment post->ctx.count in a loop doint rdma_read. - incrementing by the number of read chunks even before doing rdma read will cause issues since post->ctx.count is used while posting rdma read. Signed-off-by: Raghavendra G Signed-off-by: Anand V. Avati BUG: 1877 (data corruption while running arequal.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1877 --- rpc/rpc-transport/rdma/src/rdma.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'rpc') diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c index 63b1c2c257d..4301f4119a0 100644 --- a/rpc/rpc-transport/rdma/src/rdma.c +++ b/rpc/rpc-transport/rdma/src/rdma.c @@ -2911,7 +2911,7 @@ out: int32_t rdma_do_reads (rdma_peer_t *peer, rdma_post_t *post, rdma_read_chunk_t *readch) { - int32_t ret = -1, i = 0; + int32_t ret = -1, i = 0, count = 0; size_t size = 0; char *ptr = NULL; struct iobuf *iobuf = NULL; @@ -2931,7 +2931,6 @@ rdma_do_reads (rdma_peer_t *peer, rdma_post_t *post, rdma_read_chunk_t *readch) } post->ctx.rdma_reads = i; - post->ctx.count += post->ctx.rdma_reads; if (size > peer->trans->ctx->page_size) { gf_log (RDMA_LOG_NAME, GF_LOG_ERROR, @@ -2970,12 +2969,13 @@ rdma_do_reads (rdma_peer_t *peer, rdma_post_t *post, rdma_read_chunk_t *readch) } for (i = 0; readch[i].rc_discrim != 0; i++) { - post->ctx.vector[post->ctx.count].iov_base = ptr; - post->ctx.vector[post->ctx.count].iov_len + count = post->ctx.count++; + post->ctx.vector[count].iov_base = ptr; + post->ctx.vector[count].iov_len = readch[i].rc_target.rs_length; ret = __rdma_read (peer, post, - &post->ctx.vector[post->ctx.count], + &post->ctx.vector[count], &readch[i]); if (ret == -1) { goto unlock; -- cgit