Skip to content

Commit 71d38e4

Browse files
committed
crimson/osd/osd: mark down connections of the new down osds
Signed-off-by: Xuehan Xu <[email protected]>
1 parent 9a45a0b commit 71d38e4

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/crimson/osd/osd.cc

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,14 +1118,33 @@ seastar::future<> OSD::committed_osd_maps(
11181118
ceph_assert(seastar::this_shard_id() == PRIMARY_CORE);
11191119
INFO("osd.{} ({}, {})", whoami, first, last);
11201120
// advance through the new maps
1121+
auto old_map = osdmap;
11211122
return seastar::do_for_each(boost::make_counting_iterator(first),
11221123
boost::make_counting_iterator(last + 1),
1123-
[this](epoch_t cur) {
1124+
[this, old_map, FNAME](epoch_t cur) {
11241125
return pg_shard_manager.get_local_map(
11251126
cur
1126-
).then([this](OSDMapService::local_cached_map_t&& o) {
1127+
).then([this, old_map, FNAME](OSDMapService::local_cached_map_t&& o) {
11271128
osdmap = make_local_shared_foreign(OSDMapService::local_cached_map_t(o));
1128-
return pg_shard_manager.update_map(std::move(o));
1129+
std::set<int> old_osds;
1130+
old_map->get_all_osds(old_osds);
1131+
return seastar::parallel_for_each(
1132+
old_osds,
1133+
[this, FNAME, old_map](auto &osd_id) {
1134+
DEBUG("osd.{}: whoami ? {}, old up ? {} , now down ? {}",
1135+
osd_id, osd_id != whoami,
1136+
old_map->is_up(osd_id), osdmap->is_down(osd_id));
1137+
if (osd_id != whoami &&
1138+
old_map->is_up(osd_id) &&
1139+
osdmap->is_down(osd_id)) {
1140+
DEBUG("osd.{}: mark osd.{} down", whoami, osd_id);
1141+
return cluster_msgr->mark_down(
1142+
osdmap->get_cluster_addrs(osd_id).front());
1143+
}
1144+
return seastar::now();
1145+
}).then([this, o=std::move(o)]() mutable {
1146+
return pg_shard_manager.update_map(std::move(o));
1147+
});
11291148
}).then([this] {
11301149
if (get_shard_services().get_up_epoch() == 0 &&
11311150
osdmap->is_up(whoami) &&

0 commit comments

Comments
 (0)