From f32b37a599592d35ea948e66e7cfdfef7113b8ac Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Mon, 25 Mar 2024 22:36:07 -0700 Subject: [PATCH] crimson/osd/pg_backend: introduce INTERNAL_PG_LOCAL_NS, skip in PGBackend::list_objects Signed-off-by: Samuel Just --- src/common/hobject.h | 24 +++++++++++++++++++ .../osd/osd_operations/client_request.cc | 3 +++ src/crimson/osd/pg_backend.cc | 2 ++ 3 files changed, 29 insertions(+) diff --git a/src/common/hobject.h b/src/common/hobject.h index 8e0af9da778..cb11c0aa70f 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -313,6 +313,26 @@ public: return nspace; } + /** + * PG_LOCAL_NS + * + * Used exclusively by crimson at this time. + * + * Namespace for objects maintained by the local pg instantiation updated + * independently of the pg log. librados IO to this namespace should fail. + * Listing operations related to pg objects should exclude objects in this + * namespace along with temp objects, ec rollback objects, and the pg + * meta object. Such operations include: + * - scrub + * - backfill + * - pgls + * See crimson/osd/pg_backend PGBackend::list_objects + */ + static constexpr std::string_view INTERNAL_PG_LOCAL_NS = ".internal_pg_local"; + bool is_internal_pg_local() const { + return nspace == INTERNAL_PG_LOCAL_NS; + } + bool parse(const std::string& s); void encode(ceph::buffer::list& bl) const; @@ -482,6 +502,10 @@ struct ghobject_t { return hobj.pool >= 0 && hobj.oid.name.empty(); } + bool is_internal_pg_local() const { + return hobj.is_internal_pg_local(); + } + bool match(uint32_t bits, uint32_t match) const { return hobj.match_hash(hobj.hash, bits, match); } diff --git a/src/crimson/osd/osd_operations/client_request.cc b/src/crimson/osd/osd_operations/client_request.cc index 460f413efe3..7c1e7d321cf 100644 --- a/src/crimson/osd/osd_operations/client_request.cc +++ b/src/crimson/osd/osd_operations/client_request.cc @@ -324,6 +324,9 @@ ClientRequest::do_process( return reply_op_error(pg, -ENAMETOOLONG); } else if (m->get_hobj().oid.name.empty()) { return reply_op_error(pg, -EINVAL); + } else if (m->get_hobj().is_internal_pg_local()) { + // clients are not allowed to write to hobject_t::INTERNAL_PG_LOCAL_NS + return reply_op_error(pg, -EINVAL); } else if (pg->get_osdmap()->is_blocklisted( get_foreign_connection().get_peer_addr())) { DEBUGDPP("{}.{}: {} is blocklisted", diff --git a/src/crimson/osd/pg_backend.cc b/src/crimson/osd/pg_backend.cc index 0c9822365d1..ab60cfd1273 100644 --- a/src/crimson/osd/pg_backend.cc +++ b/src/crimson/osd/pg_backend.cc @@ -1097,6 +1097,8 @@ PGBackend::list_objects( return false; } else if (o.hobj.is_temp()) { return false; + } else if (o.is_internal_pg_local()) { + return false; } else { return o.is_no_gen(); } -- 2.39.5