]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: invalidate contents of obc_registry on interval_change
authorSamuel Just <sjust@redhat.com>
Thu, 18 Jan 2024 05:07:15 +0000 (21:07 -0800)
committerSamuel Just <sjust@redhat.com>
Sat, 20 Jan 2024 01:42:06 +0000 (17:42 -0800)
We can't guarantee that all continuations will complete before on_flush,
so we unhook and invalidate all live obcs from the registry upon
interval_change.  As long as any lingering continuations simply note the
interval change and terminate, this should be safe.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/osd/object_context.h
src/crimson/osd/object_context_loader.cc
src/crimson/osd/pg.cc

index 75c99bb5468006060dc71afce2375bef1c65c2e7..f38e52f009ce44ce064b1b4179e334e9cd3e8743 100644 (file)
@@ -112,8 +112,8 @@ public:
     }
   }
 
-  bool is_fully_loaded() const {
-    return fully_loaded;
+  bool is_loaded_and_valid() const {
+    return fully_loaded && !invalidated_by_interval_change;
   }
 
 private:
@@ -133,7 +133,10 @@ private:
   boost::intrusive::list_member_hook<> obc_accessing_hook;
   uint64_t list_link_cnt = 0;
   bool fully_loaded = false;
+  bool invalidated_by_interval_change = false;
 
+  friend class ObjectContextRegistry;
+  friend class ObjectContextLoader;
 public:
 
   template <typename ListType>
@@ -267,6 +270,12 @@ public:
     obc_lru.clear_range(from, to);
   }
 
+  void invalidate_on_interval_change() {
+    obc_lru.clear([](auto &obc) {
+      obc.invalidated_by_interval_change = true;
+    });
+  }
+
   template <class F>
   void for_each(F&& f) {
     obc_lru.for_each(std::forward<F>(f));
index f49de73f5d40af96dd0bfa2a9bae3b3db1619f52..9772ce59776a149da76a84bee8f5243376b7fac4 100644 (file)
@@ -168,7 +168,15 @@ using crimson::common::local_conf;
     auto loaded =
       load_obc_iertr::make_ready_future<ObjectContextRef>(obc);
     if (existed) {
-      ceph_assert(obc->is_fully_loaded());
+      if (!obc->is_loaded_and_valid()) {
+       ERRORDPP(
+         "obc for {} invalid -- fully_loaded={}, "
+         "invalidated_by_interval_change={}",
+         dpp, obc->get_oid(),
+         obc->fully_loaded, obc->invalidated_by_interval_change
+       );
+      }
+      ceph_assert(obc->is_loaded_and_valid());
       DEBUGDPP("cache hit on {}", dpp, obc->get_oid());
     } else {
       DEBUGDPP("cache miss on {}", dpp, obc->get_oid());
index f20ea15d66f564a9c766981ef8718002883e9d4f..b9cfdb8c19fccaa99a75a6c4cf997efbf4726537 100644 (file)
@@ -1524,6 +1524,7 @@ void PG::on_change(ceph::os::Transaction &t) {
     client_request_orderer.clear_and_cancel(*this);
   }
   scrubber.on_interval_change();
+  obc_registry.invalidate_on_interval_change();
 }
 
 void PG::context_registry_on_change() {