From 7048a3ed94503ac2ddc637a49486d17e86eb87b8 Mon Sep 17 00:00:00 2001 From: Alberto Miranda <alberto.miranda@bsc.es> Date: Tue, 8 Dec 2020 12:31:37 +0100 Subject: [PATCH] Fix transfer size if offset + size ends in block boundary --- src/client/rpc/forward_data.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client/rpc/forward_data.cpp b/src/client/rpc/forward_data.cpp index 7a01074b4..e0885ca01 100644 --- a/src/client/rpc/forward_data.cpp +++ b/src/client/rpc/forward_data.cpp @@ -132,7 +132,8 @@ forward_write(const string& path, const void* buf, const bool append_flag, } // receiver of last chunk must subtract - if(target == chnk_end_target) { + if(target == chnk_end_target && + !is_divisible(offset + write_size, gkfs::config::rpc::chunksize)) { total_chunk_size -= block_underrun(offset + write_size, gkfs::config::rpc::chunksize); } @@ -309,7 +310,8 @@ forward_read(const string& path, void* buf, const off64_t offset, } // receiver of last chunk must subtract - if(target == chnk_end_target) { + if(target == chnk_end_target && + !is_divisible(offset + read_size, gkfs::config::rpc::chunksize)) { total_chunk_size -= block_underrun(offset + read_size, gkfs::config::rpc::chunksize); } -- GitLab