]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: clear logical size on open(O_TRUNC)
authorChristopher Hoffman <choffman@redhat.com>
Wed, 18 Dec 2024 15:03:15 +0000 (15:03 +0000)
committerChristopher Hoffman <choffman@redhat.com>
Wed, 5 Nov 2025 13:59:34 +0000 (13:59 +0000)
Fixes: https://tracker.ceph.com/issues/65613
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
src/mds/Server.cc

index 98580a73cebeee7b969dcfeadc5d63dabea83316..81fac6d17e56403bab8e2044ca03063ff35281b6 100644 (file)
@@ -5698,6 +5698,8 @@ void Server::do_open_truncate(const MDRequestRef& mdr, int cmode)
 
   uint64_t old_size = std::max<uint64_t>(pi.inode->size, mdr->client_request->head.args.open.old_size);
   if (old_size > 0) {
+    if (pi.inode->fscrypt_file.size() >= sizeof(uint64_t))
+      *(ceph_le64 *)pi.inode->fscrypt_file.data() = 0;
     pi.inode->truncate(old_size, 0);
     le->metablob.add_truncate_start(in->ino());
   }