From 16e313fba3830876410739113beb1f9ae5a9eade Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 13 Aug 2010 02:08:31 +0000 Subject: fixes read data corruption seen by patch b04d963e91f8b3c72343e1043d6ed8c68699c4fe Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 1333 ([3.1.0qa4]md5sum mismatch of files on client) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1333 --- xlators/protocol/client/src/client3_1-fops.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'xlators') 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, -- cgit