From 208244f0126886a60ae7b2a2e8126a7bab6040cb Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Thu, 3 Nov 2011 14:33:24 +0530 Subject: stripe readv_cbk: Propogate the correct size and blk cnt in stbuf We were passing the stbuf returned by the first child/index, which can be different to the size/blocks returned by stat. This led to applications viewing the file as being truncated. The stbuf size needs to be the largest of all results, and blocks the aggregation from all subvolumes. (similar to stat) Change-Id: I0782f2d0d48b53c5c507a2b1fc62a6132a31ce12 BUG: 3774 Reviewed-on: http://review.gluster.com/664 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi --- xlators/cluster/stripe/src/stripe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index d47acd6b3..d42d88b12 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -3555,6 +3555,9 @@ stripe_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, mlocal->replies[index].stbuf = *stbuf; mlocal->replies[index].count = count; mlocal->replies[index].vector = iov_dup (vector, count); + if (local->stbuf_size < stbuf->ia_size) + local->stbuf_size = stbuf->ia_size; + local->stbuf_blocks += stbuf->ia_blocks; if (!mlocal->iobref) mlocal->iobref = iobref_new (); @@ -3612,6 +3615,8 @@ stripe_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * cause any bugs at higher levels */ memcpy (&tmp_stbuf, &mlocal->replies[0].stbuf, sizeof (struct iatt)); + tmp_stbuf.ia_size = local->stbuf_size; + tmp_stbuf.ia_blocks = local->stbuf_blocks; done: /* */ -- cgit