]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: generate symlink inode with correct mode 63937/head
authorKefu Chai <tchaikov@gmail.com>
Fri, 13 Jun 2025 12:22:20 +0000 (20:22 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sun, 15 Jun 2025 06:54:54 +0000 (14:54 +0800)
Fix test instance generation for InodeStoreBare and InodeStore to
properly set the mode field to S_IFLNK for symlink inodes.

Previously, generated test instances with symlink inodes had unset
mode fields, creating inconsistent data. This issue was masked because
ceph-dencoder reused existing instances during encode/decode consistency
tests, leaving stale values intact.

The problem would surface when check-generated.sh and readable.sh
allocate fresh instances for decoding tests, as the missing mode field
would cause decode/encode inconsistencies.

This change fixes generate_test_instances() to set the mode field to
S_IFLNK for symlink inodes, creating valid InodeStore and InodeStoreBare
instances with consistent field values for proper encode/decode testing.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/mds/CInode.cc

index 01fd41fa6587277e90330afcfc4b98ea6e22bb05..e538a759f952901570e106ec28877fa25dda2bcf 100644 (file)
@@ -4768,6 +4768,7 @@ void InodeStore::generate_test_instances(std::list<InodeStore*> &ls)
 {
   InodeStore *populated = new InodeStore;
   populated->get_inode()->ino = 0xdeadbeef;
+  populated->get_inode()->mode = S_IFLNK | 0777;
   populated->symlink = "rhubarb";
   ls.push_back(populated);
 }
@@ -4776,6 +4777,7 @@ void InodeStoreBare::generate_test_instances(std::list<InodeStoreBare*> &ls)
 {
   InodeStoreBare *populated = new InodeStoreBare;
   populated->get_inode()->ino = 0xdeadbeef;
+  populated->get_inode()->mode = S_IFLNK | 0777;
   populated->symlink = "rhubarb";
   ls.push_back(populated);
 }