From: Dhairya Parmar Date: Wed, 6 Aug 2025 21:32:05 +0000 (+0530) Subject: common,mds: transmit SNAPDIR_VISIBILITY flag via SnapRealmInfoNew X-Git-Tag: testing/wip-vshankar-testing-20250926.115258-debug^2~6 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9540f543011a9aa08886a14159323cc68722faa4;p=ceph-ci.git common,mds: transmit SNAPDIR_VISIBILITY flag via SnapRealmInfoNew at the time of building snap trace Fixes: https://tracker.ceph.com/issues/71740 Signed-off-by: Dhairya Parmar --- diff --git a/src/common/snap_types.cc b/src/common/snap_types.cc index ad0313bde70..05b19846af6 100644 --- a/src/common/snap_types.cc +++ b/src/common/snap_types.cc @@ -65,6 +65,7 @@ void SnapRealmInfoNew::encode(ceph::buffer::list& bl) const encode(info, bl); encode(last_modified, bl); encode(change_attr, bl); + encode(flags, bl); ENCODE_FINISH(bl); } @@ -75,6 +76,7 @@ void SnapRealmInfoNew::decode(ceph::buffer::list::const_iterator& bl) decode(info, bl); decode(last_modified, bl); decode(change_attr, bl); + decode(flags, bl); DECODE_FINISH(bl); } @@ -83,16 +85,17 @@ void SnapRealmInfoNew::dump(ceph::Formatter *f) const info.dump(f); f->dump_stream("last_modified") << last_modified; f->dump_unsigned("change_attr", change_attr); + f->dump_bool("is_snapdir_visible", flags & SNAPDIR_VISIBILITY); } std::list SnapRealmInfoNew::generate_test_instances() { std::list o; o.emplace_back(); - o.push_back(SnapRealmInfoNew(SnapRealmInfo(1, 10, 10, 0), utime_t(), 0)); - o.push_back(SnapRealmInfoNew(SnapRealmInfo(1, 10, 10, 0), utime_t(), 1)); + o.push_back(SnapRealmInfoNew(SnapRealmInfo(1, 10, 10, 0), utime_t(), 0, 1)); + o.push_back(SnapRealmInfoNew(SnapRealmInfo(1, 10, 10, 0), utime_t(), 1, 1)); o.back().info.my_snaps.push_back(10); - o.push_back(SnapRealmInfoNew(SnapRealmInfo(1, 10, 10, 5), utime_t(), 2)); + o.push_back(SnapRealmInfoNew(SnapRealmInfo(1, 10, 10, 5), utime_t(), 2, 1)); o.back().info.my_snaps.push_back(10); o.back().info.prior_parent_snaps.push_back(3); o.back().info.prior_parent_snaps.push_back(5); diff --git a/src/common/snap_types.h b/src/common/snap_types.h index 211958a9229..b194f7c43b0 100644 --- a/src/common/snap_types.h +++ b/src/common/snap_types.h @@ -51,15 +51,20 @@ struct SnapRealmInfoNew { SnapRealmInfo info; utime_t last_modified; uint64_t change_attr; + uint32_t flags; + enum { + SNAPDIR_VISIBILITY = 4, + }; SnapRealmInfoNew() { } - SnapRealmInfoNew(const SnapRealmInfo &info_, utime_t last_modified_, uint64_t change_attr_) { + SnapRealmInfoNew(const SnapRealmInfo &info_, utime_t last_modified_, uint64_t change_attr_, __u32 flags_) { // FIPS zeroization audit 20191115: this memset is not security related. info = info_; last_modified = last_modified_; change_attr = change_attr_; + flags = flags_; } inodeno_t ino() const { return inodeno_t(info.h.ino); } diff --git a/src/mds/SnapRealm.cc b/src/mds/SnapRealm.cc index 3e427c157af..e8667fc83c2 100644 --- a/src/mds/SnapRealm.cc +++ b/src/mds/SnapRealm.cc @@ -446,7 +446,8 @@ void SnapRealm::build_snap_trace() const dout(10) << "build_snap_trace my_snaps " << info.my_snaps << dendl; - SnapRealmInfoNew ninfo(info, srnode.last_modified, srnode.change_attr); + SnapRealmInfoNew ninfo(info, srnode.last_modified, + srnode.change_attr, srnode.flags); encode(info, cached_snap_trace); encode(ninfo, cached_snap_trace_new); return; @@ -481,7 +482,8 @@ void SnapRealm::build_snap_trace() const info.my_snaps.push_back(p->first); dout(10) << "build_snap_trace my_snaps " << info.my_snaps << dendl; - SnapRealmInfoNew ninfo(info, srnode.last_modified, srnode.change_attr); + SnapRealmInfoNew ninfo(info, srnode.last_modified, + srnode.change_attr, srnode.flags); encode(info, cached_snap_trace); encode(ninfo, cached_snap_trace_new);