]> git.apps.os.sepia.ceph.com Git - ceph-ci.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:52:07 +0000 (11:52 -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 8694dfc72a2e6f8145e8b803a6e81d23e24696e6..9caa7ca92eb44cb1323f0a05a41fd07d56a69c68 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 3828fe04d7b2a41af1fc3afeb4c243ba32a34005..ce805ea7ff53ecde3a1f924dd05b392016422c29 100644 (file)
@@ -2500,6 +2500,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);