summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-08-13 02:08:31 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-13 00:56:51 -0700
commit16e313fba3830876410739113beb1f9ae5a9eade (patch)
tree5b175d0a36f67dcde760e0b1f380638a2895fc5d
parent79ec0ccdfacf562f19c0c0959ed305ec204f71bf (diff)
fixes read data corruption seen by patch b04d963e91f8b3c72343e1043d6ed8c68699c4fe
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1333 ([3.1.0qa4]md5sum mismatch of files on client) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1333
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index 32ebb0b1e..db24630e7 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -1983,7 +1983,7 @@ client3_1_readv_cbk (struct rpc_req *req, struct iovec *iov, int count,
struct iovec vector[MAX_IOVEC];
struct iatt stat = {0,};
gfs3_read_rsp rsp = {0,};
- int ret = 0, rspcount = 0, i = 0;
+ int ret = 0, rspcount = 0;
memset (vector, 0, sizeof (vector));
@@ -2007,15 +2007,10 @@ client3_1_readv_cbk (struct rpc_req *req, struct iovec *iov, int count,
iobref = req->rsp_iobref;
gf_stat_to_iatt (&rsp.stat, &stat);
- if (ret < req->rsp[0].iov_len) {
- vector[0].iov_base = req->rsp[0].iov_base + ret;
- vector[0].iov_len = req->rsp[0].iov_len - ret;
- rspcount = 1;
- }
-
- for (i = 1; i < req->rspcnt; i++) {
- vector[rspcount++] = req->rsp[i];
- }
+ vector[0].iov_len = rsp.op_ret;
+ if (rsp.op_ret > 0)
+ vector[0].iov_base = req->rsp[1].iov_base;
+ rspcount = 1;
}
out:
STACK_UNWIND_STRICT (readv, frame, rsp.op_ret,