]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: Use correct sizes on write_success
authorChristopher Hoffman <choffman@redhat.com>
Wed, 18 Dec 2024 15:38:02 +0000 (15:38 +0000)
committerChristopher Hoffman <choffman@redhat.com>
Thu, 14 Aug 2025 20:09:46 +0000 (20:09 +0000)
Fixes: https://tracker.ceph.com/issues/69302
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
src/client/Client.cc

index 20c420312b4803365aa808ec4c15e4774ccefdcd..cf11c09fa2903cab1f9b373c31c91d5697d23a6f 100644 (file)
@@ -12053,12 +12053,14 @@ int64_t Client::_write_success(Fh *f, utime_t start, uint64_t fpos,
 
   // extend file?
   if (request_size + request_offset > in->effective_size()) {
+    size = request_size + request_offset;
     if (encrypted) {
-      in->set_effective_size(request_size + request_offset);
+      in->set_effective_size(size);
       in->mark_caps_dirty(CEPH_CAP_FILE_EXCL);
+      size = fscrypt_next_block_start(offset + size);
     }
     ldout(cct, 7) << "in->effective_size()=" << in->effective_size() << dendl;
-    in->size = offset + size;
+    in->size = size;
     in->mark_caps_dirty(CEPH_CAP_FILE_WR);
 
     if (is_quota_bytes_approaching(in, f->actor_perms)) {
@@ -17417,7 +17419,11 @@ int Client::_fallocate(Fh *fh, int mode, int64_t offset, int64_t length)
     }
   } else if (!(mode & FALLOC_FL_KEEP_SIZE)) {
     uint64_t size = offset + length;
-    if (size > in->size) {
+    if (size > in->effective_size()) {
+      if (in->is_fscrypt_enabled()) {
+        in->set_effective_size(size);
+        size = fscrypt_next_block_start(size);
+      }
       in->size = size;
       in->mtime = in->ctime = ceph_clock_now();
       in->change_attr++;