]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: Fix logic in need read start/end to account for fscrypt.
authorChristopher Hoffman <choffman@redhat.com>
Thu, 11 Apr 2024 17:37:55 +0000 (17:37 +0000)
committerChristopher Hoffman <choffman@redhat.com>
Thu, 14 Aug 2025 20:08:08 +0000 (20:08 +0000)
Fix the logic in need read start/end. We need to make sure that a
whole block is read when a rmw is issued, regardless if it starts
at offset 0 or not. Change size that may be read from where offset
starts to the whole fscrypt block.

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

index 3188a1a14c50c987de8b1c65b47e983ab678f384..b30e91387762f38dfc76e5ff248d77e5aba68b52 100644 (file)
@@ -12148,12 +12148,10 @@ int Client::WriteEncMgr::read_modify_write(Context *_iofinish)
   end_block_ofs = fscrypt_block_start(endoff - 1);
   ofs_in_end_block = fscrypt_ofs_in_block(endoff - 1);
 
-  need_read_start = ofs_in_start_block > 0;
+  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);
+  read_start_size = FSCRYPT_BLOCK_SIZE;
 
-  read_start_size = (need_read_start && need_read_end && start_block == end_block ?
-                     FSCRYPT_BLOCK_SIZE : ofs_in_start_block);
-  
   bool need_read = need_read_start | need_read_end;