From 7b631e7a480abc97205a1b668a17f42c6ec8b62c Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 13 Jun 2025 20:22:20 +0800 Subject: [PATCH] mds: generate symlink inode with correct mode 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 --- src/mds/CInode.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index 01fd41fa65872..e538a759f9529 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -4768,6 +4768,7 @@ void InodeStore::generate_test_instances(std::list &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 &ls) { InodeStoreBare *populated = new InodeStoreBare; populated->get_inode()->ino = 0xdeadbeef; + populated->get_inode()->mode = S_IFLNK | 0777; populated->symlink = "rhubarb"; ls.push_back(populated); } -- 2.39.5