]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add warning about encoding new fields
authorPatrick Donnelly <pdonnell@redhat.com>
Sat, 8 Jun 2024 19:00:27 +0000 (15:00 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 24 Jun 2024 15:51:42 +0000 (11:51 -0400)
It's never a good idea to put new fields in the middle of other encoded values
unless you're willing to break all backwards-compatibility.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit d27b1156ae7d38902c76ffa48b6999a779ec5da9)

src/mds/CDentry.cc
src/mds/CDir.cc

index 6722f0f2a3670663849d4b1b7ba4cac5be955158..5f155f999bc7b59541b4a91b258684b80231a994 100644 (file)
@@ -568,6 +568,7 @@ void CDentry::encode_remote(inodeno_t& ino, unsigned char d_type,
 
   // marker, name, ino
   ENCODE_START(2, 1, bl);
+  // WARNING: always put new fields at the end of bl
   encode(ino, bl);
   encode(d_type, bl);
   encode(alternate_name, bl);
index a8aaf11c0512c2eef9b33108ee5236a92319aab0..30dcd9c539388b3c292b65ad44f23ee7b0a2a87e 100644 (file)
@@ -2495,6 +2495,7 @@ void CDir::_omap_commit_ops(int r, int op_prio, int64_t metapool, version_t vers
       bl.append('i');         // inode
 
       ENCODE_START(2, 1, bl);
+      // WARNING: always put new fields at the end of bl
       encode(item.alternate_name, bl);
       _encode_primary_inode_base(item, dfts, bl);
       ENCODE_FINISH(bl);