summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2019-08-07 12:12:43 +0530
committerhari gowtham <hari.gowtham005@gmail.com>2019-10-24 09:24:22 +0000
commit02f26172c00143953310e9dd4f8ec08f3de66954 (patch)
tree8447a37619dddb72d7f0281e2331e0148bcc1ea4 /xlators
parent3b6d7a1ef0ad8c50984354e941af68ca80261da7 (diff)
features/shard: Send correct size when reads are sent beyond file size
Change-Id: I0cebaaf55c09eb1fb77a274268ff564e871b743b fixes bz#1737141 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> (cherry picked from commit 51237eda7c4b3846d08c5d24d1e3fe9b7ffba1d4)
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/shard/src/shard.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index 302130cd6f8..5ddd3bbd0ad 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -4748,6 +4748,8 @@ out:
if (xdata)
local->xattr_rsp = dict_ref(xdata);
vec.iov_base = local->iobuf->ptr;
+ if (local->offset + local->req_size > local->prebuf.ia_size)
+ local->total_size = local->prebuf.ia_size - local->offset;
vec.iov_len = local->total_size;
local->op_ret = local->total_size;
SHARD_STACK_UNWIND(readv, frame, local->op_ret, local->op_errno,