Skip to content

Commit ddac5d1

Browse files
committed
crimson/osd/shard_services: make sure that only up/acting members can
create pgs Fixes: https://tracker.ceph.com/issues/64282 Signed-off-by: Xuehan Xu <[email protected]>
1 parent 7000cbf commit ddac5d1

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/crimson/osd/shard_services.cc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,15 +610,23 @@ seastar::future<Ref<PG>> ShardServices::make_pg(
610610

611611
seastar::future<Ref<PG>> ShardServices::handle_pg_create_info(
612612
std::unique_ptr<PGCreateInfo> info) {
613-
LOG_PREFIX(OSDSingletonState::trim_maps);
614613
return seastar::do_with(
615614
std::move(info),
616-
[FNAME, this](auto &info)
615+
[this](auto &info)
617616
-> seastar::future<Ref<PG>> {
618617
return get_map(info->epoch).then(
619-
[&info, FNAME, this](cached_map_t startmap)
618+
[&info, this](cached_map_t startmap)
620619
-> seastar::future<std::tuple<Ref<PG>, cached_map_t>> {
620+
LOG_PREFIX(ShardServices::handle_pg_create_info);
621621
const spg_t &pgid = info->pgid;
622+
if (!get_map()->is_up_acting_osd_shard(pgid, local_state.whoami)
623+
|| !startmap->is_up_acting_osd_shard(pgid, local_state.whoami)) {
624+
DEBUG("ignore pgid {}, doesn't exist anymore, discarding");
625+
local_state.pg_map.pg_creation_canceled(pgid);
626+
return seastar::make_ready_future<
627+
std::tuple<Ref<PG>, OSDMapService::cached_map_t>
628+
>(std::make_tuple(Ref<PG>(), startmap));
629+
}
622630
if (info->by_mon) {
623631
int64_t pool_id = pgid.pgid.pool();
624632
const pg_pool_t *pool = get_map()->get_pg_pool(pool_id);

0 commit comments

Comments
 (0)