Skip to content

Commit f32b37a

Browse files
committed
crimson/osd/pg_backend: introduce INTERNAL_PG_LOCAL_NS, skip in PGBackend::list_objects
Signed-off-by: Samuel Just <[email protected]>
1 parent 4f056a4 commit f32b37a

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

src/common/hobject.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,26 @@ struct hobject_t {
313313
return nspace;
314314
}
315315

316+
/**
317+
* PG_LOCAL_NS
318+
*
319+
* Used exclusively by crimson at this time.
320+
*
321+
* Namespace for objects maintained by the local pg instantiation updated
322+
* independently of the pg log. librados IO to this namespace should fail.
323+
* Listing operations related to pg objects should exclude objects in this
324+
* namespace along with temp objects, ec rollback objects, and the pg
325+
* meta object. Such operations include:
326+
* - scrub
327+
* - backfill
328+
* - pgls
329+
* See crimson/osd/pg_backend PGBackend::list_objects
330+
*/
331+
static constexpr std::string_view INTERNAL_PG_LOCAL_NS = ".internal_pg_local";
332+
bool is_internal_pg_local() const {
333+
return nspace == INTERNAL_PG_LOCAL_NS;
334+
}
335+
316336
bool parse(const std::string& s);
317337

318338
void encode(ceph::buffer::list& bl) const;
@@ -482,6 +502,10 @@ struct ghobject_t {
482502
return hobj.pool >= 0 && hobj.oid.name.empty();
483503
}
484504

505+
bool is_internal_pg_local() const {
506+
return hobj.is_internal_pg_local();
507+
}
508+
485509
bool match(uint32_t bits, uint32_t match) const {
486510
return hobj.match_hash(hobj.hash, bits, match);
487511
}

src/crimson/osd/osd_operations/client_request.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ ClientRequest::do_process(
324324
return reply_op_error(pg, -ENAMETOOLONG);
325325
} else if (m->get_hobj().oid.name.empty()) {
326326
return reply_op_error(pg, -EINVAL);
327+
} else if (m->get_hobj().is_internal_pg_local()) {
328+
// clients are not allowed to write to hobject_t::INTERNAL_PG_LOCAL_NS
329+
return reply_op_error(pg, -EINVAL);
327330
} else if (pg->get_osdmap()->is_blocklisted(
328331
get_foreign_connection().get_peer_addr())) {
329332
DEBUGDPP("{}.{}: {} is blocklisted",

src/crimson/osd/pg_backend.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,8 @@ PGBackend::list_objects(
10971097
return false;
10981098
} else if (o.hobj.is_temp()) {
10991099
return false;
1100+
} else if (o.is_internal_pg_local()) {
1101+
return false;
11001102
} else {
11011103
return o.is_no_gen();
11021104
}

0 commit comments

Comments
 (0)