]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: Simplify blocklist tracking and interface
authorGreg Farnum <gfarnum@redhat.com>
Mon, 1 Nov 2021 23:52:53 +0000 (23:52 +0000)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 13 Apr 2022 00:14:15 +0000 (00:14 +0000)
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 <gfarnum@redhat.com>
src/client/Client.cc

index 00cf1f2d351491f8fe22a200343124078c622d43..82ee7c0f77bbe4f5ced5bc65363c4c17ac99cad4 100644 (file)
@@ -576,7 +576,6 @@ void Client::_pre_init()
 
   objecter_finisher.start();
   filer.reset(new Filer(objecter, &objecter_finisher));
-  objecter->enable_blocklist_events();
 
   objectcacher->start();
 }
@@ -2715,36 +2714,15 @@ void Client::_handle_full_flag(int64_t pool)
 
 void Client::handle_osd_map(const MConstRef<MOSDMap>& m)
 {
-  std::set<entity_addr_t> 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();
         });