]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.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>
Thu, 14 Aug 2025 20:09:46 +0000 (20:09 +0000)
Fixes: https://tracker.ceph.com/issues/65613
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
src/mds/Server.cc

index 77a93ceb76d18dd0ade153ccbbebfbc92e538413..c1931003bcdcf550d37ca9a9e3e03cc20cca7e6d 100644 (file)
@@ -5688,6 +5688,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());
   }