]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: fscrypt rmw fails when endoff end of block or file
authorChristopher Hoffman <choffman@redhat.com>
Tue, 7 May 2024 00:59:11 +0000 (00:59 +0000)
committerChristopher Hoffman <choffman@redhat.com>
Thu, 14 Aug 2025 20:08:08 +0000 (20:08 +0000)
Fscrypt rmw fails when end of a write lines up with end of
a block or end of the file.

Fixes: https://tracker.ceph.com/issues/65745
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
src/client/Client.cc

index 195489b19a4b7c69f43c729c2b588be790e2a7bb..be1206a3246caabb14042377026e87648d487f9a 100644 (file)
@@ -12150,7 +12150,7 @@ int Client::WriteEncMgr::read_modify_write(Context *_iofinish)
   ofs_in_end_block = fscrypt_ofs_in_block(endoff - 1);
 
   need_read_start = ofs_in_start_block >= 0;
-  need_read_end = (endoff < in->effective_size() && ofs_in_end_block < FSCRYPT_BLOCK_SIZE - 1 && start_block != end_block);
+  need_read_end = (endoff <= in->effective_size() && ofs_in_end_block < FSCRYPT_BLOCK_SIZE && start_block != end_block);
   read_start_size = FSCRYPT_BLOCK_SIZE;
 
   bool need_read = need_read_start | need_read_end;