From ffbe9470cd189b7921509c08c9b2d308b8ac390e Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Fri, 29 Oct 2010 03:13:22 +0000 Subject: rpc-transport: fix race-condition between rdma-read completion and updating the count of number of vectors to be passed to rpc. - If rdma read completes before incrementing the vector count, the count value sent to rpc will be improper. For fops like write, this may result in missing out a vector to be written, thereby causing data corruption. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rpc/rpc-transport/rdma') diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c index 6a95f9294..63b1c2c25 100644 --- a/rpc/rpc-transport/rdma/src/rdma.c +++ b/rpc/rpc-transport/rdma/src/rdma.c @@ -2931,6 +2931,7 @@ 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, @@ -2980,7 +2981,6 @@ rdma_do_reads (rdma_peer_t *peer, rdma_post_t *post, rdma_read_chunk_t *readch) goto unlock; } - post->ctx.count++; ptr += readch[i].rc_target.rs_length; } -- cgit