From 7b4d6e3ec61e9cb0b9d0ffa0aef2117b96e63f65 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Thu, 6 Feb 2014 12:32:01 -0800 Subject: 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 Reviewed-on: http://review.gluster.org/6932 Tested-by: Gluster Build System Reviewed-by: Raghavendra Bhat --- xlators/storage/posix/src/posix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xlators/storage') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 890e51197..64465c618 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: -- cgit