summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2014-02-06 12:32:01 -0800
committerAnand Avati <avati@redhat.com>2014-02-13 11:18:39 -0800
commit7b4d6e3ec61e9cb0b9d0ffa0aef2117b96e63f65 (patch)
treeb7eaa8ee989c03155b40d506bb295f376eb228d7 /xlators
parent0cab34b3a5e94267bf6b39669b6e85af1fab8f3d (diff)
storage/posix: calculate checksum only over read data
If the last block of a file is not aligned to the requested size, checksum is calculated over junk data in the iobuf. Or it could be zeroes, resulting in a spurious checksum match in self-heal. Change-Id: I41422e08de90013dabfc348ec6fbb8ecdd4f8fb8 BUG: 1021686 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/6932 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/storage/posix/src/posix.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 890e5119730..64465c61872 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -5026,8 +5026,8 @@ posix_rchecksum (call_frame_t *frame, xlator_t *this,
if (ret < 0)
goto out;
- weak_checksum = gf_rsync_weak_checksum ((unsigned char *) buf, (size_t) len);
- gf_rsync_strong_checksum ((unsigned char *) buf, (size_t) len, (unsigned char *) strong_checksum);
+ weak_checksum = gf_rsync_weak_checksum ((unsigned char *) buf, (size_t) ret);
+ gf_rsync_strong_checksum ((unsigned char *) buf, (size_t) ret, (unsigned char *) strong_checksum);
op_ret = 0;
out: