From: Greg Farnum Date: Mon, 1 Nov 2021 23:52:53 +0000 (+0000) Subject: client: Simplify blocklist tracking and interface X-Git-Tag: v17.2.1~15^2~26 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4ac8d58b0d27888c30843a239ca5e9e8f659c805;p=ceph.git client: Simplify blocklist tracking and interface I'm not sure if the blocklist events tracking in Client.cc was ever the simplest way to track that state, but it definitely isn't now. We can just hand our addr_vec to the OSDMap and ask it -- it handles version compatibility issues and, happily, means the Client doesn't need to learn to deal with ranges directly. Signed-off-by: Greg Farnum (cherry picked from commit 5f57daedc9550aaeb8b55e2c8dc71b6f27372e84) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 6231a337bccc..17ba4255d7b1 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -552,7 +552,6 @@ void Client::_pre_init() objecter_finisher.start(); filer.reset(new Filer(objecter, &objecter_finisher)); - objecter->enable_blocklist_events(); objectcacher->start(); } @@ -2650,36 +2649,15 @@ void Client::_handle_full_flag(int64_t pool) void Client::handle_osd_map(const MConstRef& m) { - std::set new_blocklists; - std::scoped_lock cl(client_lock); - objecter->consume_blocklist_events(&new_blocklists); const auto myaddrs = messenger->get_myaddrs(); - bool new_blocklist = false; - bool prenautilus = objecter->with_osdmap( + bool new_blocklist = objecter->with_osdmap( [&](const OSDMap& o) { - return o.require_osd_release < ceph_release_t::nautilus; + return o.is_blocklisted(myaddrs); }); - if (!blocklisted) { - for (auto a : myaddrs.v) { - // blocklist entries are always TYPE_ANY for nautilus+ - a.set_type(entity_addr_t::TYPE_ANY); - if (new_blocklists.count(a)) { - new_blocklist = true; - break; - } - if (prenautilus) { - // ...except pre-nautilus, they were TYPE_LEGACY - a.set_type(entity_addr_t::TYPE_LEGACY); - if (new_blocklists.count(a)) { - new_blocklist = true; - break; - } - } - } - } - if (new_blocklist) { + + if (new_blocklist && !blocklisted) { auto epoch = objecter->with_osdmap([](const OSDMap &o){ return o.get_epoch(); });