diff options
| author | Raghavendra G <raghavendra@gluster.com> | 2010-11-01 01:25:03 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2010-11-07 20:15:02 -0800 | 
| commit | 56450b818756a762c925c76f8c6218ea1c5f7efe (patch) | |
| tree | 17ca10fe486b5637a90e1f6c75c291c4e1c0170f | |
| parent | 86a1ef81527da5b9eb11ba3dc361c1c4ca291ca8 (diff) | |
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 <raghavendra@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1877 (data corruption while running arequal.)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1877
| -rw-r--r-- | rpc/rpc-transport/rdma/src/rdma.c | 10 | 
1 files changed, 5 insertions, 5 deletions
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;  | 
