Skip to content

Commit b0e6ce3

Browse files
author
zhangjianwei2
committed
osd/OSD: reply pg_created when pg is peered
Problem: when PG is active+clean ceph osd force-create-pg 1.0 --yes-i-really-mean-it because osd is not reply pg_created to mon. Affects: pool remains creating flags, mon creating_pgs.pg is not empty, lead to mon cannot trim OSDMaps Solution: add PgCreateEvt for pg create if pg Active and is_peered, reply pg_created to mon. Fixes: https://tracker.ceph.com/issues/63912 Signed-off-by: zhangjianwei2 <[email protected]>
1 parent 9bb8ee4 commit b0e6ce3

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

src/osd/OSD.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,7 @@ void OSDService::send_pg_created(pg_t pgid)
12651265
auto o = get_osdmap();
12661266
if (o->require_osd_release >= ceph_release_t::luminous) {
12671267
pg_created.insert(pgid);
1268+
dout(20) << __func__ << " reply to mon " << pgid << " created." << dendl;
12681269
monc->send_mon_message(new MOSDPGCreated(pgid));
12691270
}
12701271
}
@@ -1276,6 +1277,7 @@ void OSDService::send_pg_created()
12761277
auto o = get_osdmap();
12771278
if (o->require_osd_release >= ceph_release_t::luminous) {
12781279
for (auto pgid : pg_created) {
1280+
dout(20) << __func__ << " reply to mon " << pgid << " created!" << dendl;
12791281
monc->send_mon_message(new MOSDPGCreated(pgid));
12801282
}
12811283
}
@@ -9222,7 +9224,7 @@ void OSD::handle_fast_pg_create(MOSDPGCreate2 *m)
92229224
std::make_shared<PGPeeringEvent>(
92239225
m->epoch,
92249226
m->epoch,
9225-
NullEvt(),
9227+
PgCreateEvt(),
92269228
true,
92279229
new PGCreateInfo(
92289230
pgid,

src/osd/PGPeeringEvent.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ struct RequestRecoveryPrio : boost::statechart::event< RequestRecoveryPrio > {
193193
};
194194

195195
TrivialEvent(NullEvt)
196+
TrivialEvent(PgCreateEvt)
196197
TrivialEvent(RemoteBackfillReserved)
197198
TrivialEvent(RemoteReservationRejectedTooFull)
198199
TrivialEvent(RemoteReservationRevokedTooFull)

src/osd/PeeringState.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6332,6 +6332,22 @@ boost::statechart::result PeeringState::Active::react(const CheckReadable &evt)
63326332
return discard_event();
63336333
}
63346334

6335+
boost::statechart::result PeeringState::Active::react(const PgCreateEvt &evt)
6336+
{
6337+
DECLARE_LOCALS;
6338+
pg_t pgid = context< PeeringMachine >().spgid.pgid;
6339+
6340+
psdout(10) << __func__ << " receive PgCreateEvt"
6341+
<< " is_peered=" << ps->is_peered() << dendl;
6342+
6343+
if (ps->is_peered()) {
6344+
psdout(10) << __func__ << " pg is peered, reply pg_created" << dendl;
6345+
pl->send_pg_created(pgid);
6346+
}
6347+
6348+
return discard_event();
6349+
}
6350+
63356351
/*
63366352
* update info.history.last_epoch_started ONLY after we and all
63376353
* replicas have activated AND committed the activate transaction

src/osd/PeeringState.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ class PeeringState : public MissingLoc::MappingInfo {
690690
typedef boost::mpl::list <
691691
boost::statechart::transition< Initialize, Reset >,
692692
boost::statechart::custom_reaction< NullEvt >,
693+
boost::statechart::custom_reaction< PgCreateEvt >,
693694
boost::statechart::transition< boost::statechart::event_base, Crashed >
694695
> reactions;
695696

@@ -711,6 +712,7 @@ class PeeringState : public MissingLoc::MappingInfo {
711712
boost::statechart::custom_reaction< AdvMap >,
712713
boost::statechart::custom_reaction< ActMap >,
713714
boost::statechart::custom_reaction< NullEvt >,
715+
boost::statechart::custom_reaction< PgCreateEvt >,
714716
boost::statechart::custom_reaction< IntervalFlush >,
715717
boost::statechart::transition< boost::statechart::event_base, Crashed >
716718
> reactions;
@@ -737,6 +739,7 @@ class PeeringState : public MissingLoc::MappingInfo {
737739
boost::statechart::custom_reaction< IntervalFlush >,
738740
// ignored
739741
boost::statechart::custom_reaction< NullEvt >,
742+
boost::statechart::custom_reaction< PgCreateEvt >,
740743
boost::statechart::custom_reaction<SetForceRecovery>,
741744
boost::statechart::custom_reaction<UnsetForceRecovery>,
742745
boost::statechart::custom_reaction<SetForceBackfill>,
@@ -867,7 +870,8 @@ class PeeringState : public MissingLoc::MappingInfo {
867870
boost::statechart::custom_reaction< DoRecovery>,
868871
boost::statechart::custom_reaction< RenewLease>,
869872
boost::statechart::custom_reaction< MLeaseAck>,
870-
boost::statechart::custom_reaction< CheckReadable>
873+
boost::statechart::custom_reaction< CheckReadable>,
874+
boost::statechart::custom_reaction< PgCreateEvt >
871875
> reactions;
872876
boost::statechart::result react(const QueryState& q);
873877
boost::statechart::result react(const QueryUnfound& q);
@@ -906,6 +910,7 @@ class PeeringState : public MissingLoc::MappingInfo {
906910
return discard_event();
907911
}
908912
boost::statechart::result react(const CheckReadable&);
913+
boost::statechart::result react(const PgCreateEvt&);
909914
void all_activated_and_committed();
910915
};
911916

0 commit comments

Comments
 (0)