From 14b09519739f3b2dc715647fd0f04dd22c17aeb3 Mon Sep 17 00:00:00 2001 From: shenjiatong Date: Sat, 2 Nov 2024 16:10:38 +0800 Subject: Make mon addrs consistent with mon info For legacy librbd clients, sanitize_mons will panic if addrs are not consistent with mon_info_t. Signed-off-by: shenjiatong fixes: https://tracker.ceph.com/issues/68743 --- src/mon/MonMap.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mon/MonMap.cc b/src/mon/MonMap.cc index 6eb37df171a..28681a5e411 100644 --- a/src/mon/MonMap.cc +++ b/src/mon/MonMap.cc @@ -196,7 +196,12 @@ void MonMap::encode(ceph::buffer::list& blist, uint64_t con_features) const if (!HAVE_FEATURE(con_features, MONENC) || !HAVE_FEATURE(con_features, SERVER_NAUTILUS)) { for (auto& [name, info] : mon_info) { - legacy_mon_addr[name] = info.public_addrs.legacy_addr(); + // see note in mon_info_t::encode() + auto addr = info.public_addrs.legacy_addr(); + if (addr == entity_addr_t()) { + addr = info.public_addrs.as_legacy_addr(); + } + legacy_mon_addr[name] = addr; } } -- cgit v1.2.3