From: Samuel Just Date: Thu, 18 Jan 2024 05:07:15 +0000 (-0800) Subject: crimson/osd: invalidate contents of obc_registry on interval_change X-Git-Tag: testing/wip-batrick-testing-20240411.154038~602^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=83d535cd27e8acd373fa4fbc9405d26272446028;p=ceph-ci.git crimson/osd: invalidate contents of obc_registry on interval_change 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 --- diff --git a/src/crimson/osd/object_context.h b/src/crimson/osd/object_context.h index 75c99bb5468..f38e52f009c 100644 --- a/src/crimson/osd/object_context.h +++ b/src/crimson/osd/object_context.h @@ -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 @@ -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 void for_each(F&& f) { obc_lru.for_each(std::forward(f)); diff --git a/src/crimson/osd/object_context_loader.cc b/src/crimson/osd/object_context_loader.cc index f49de73f5d4..9772ce59776 100644 --- a/src/crimson/osd/object_context_loader.cc +++ b/src/crimson/osd/object_context_loader.cc @@ -168,7 +168,15 @@ using crimson::common::local_conf; auto loaded = load_obc_iertr::make_ready_future(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()); diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index f20ea15d66f..b9cfdb8c19f 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -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() {