@@ -47,9 +47,9 @@ void on_event_discard(std::string_view nm)
4747 dout (20 ) << " event: --^^^^---- " << nm << dendl;
4848}
4949
50- void ScrubMachine::assert_not_active () const
50+ void ScrubMachine::assert_not_in_session () const
5151{
52- ceph_assert (state_cast<const NotActive *>());
52+ ceph_assert (! state_cast<const Session *>());
5353}
5454
5555bool ScrubMachine::is_reserving () const
@@ -114,27 +114,64 @@ NotActive::NotActive(my_context ctx)
114114 scrbr->clear_queued_or_active ();
115115}
116116
117- sc::result NotActive::react (const StartScrub&)
117+
118+ // ----------------------- PrimaryActive --------------------------------
119+
120+ PrimaryActive::PrimaryActive (my_context ctx)
121+ : my_base(ctx)
122+ , NamedSimply(context<ScrubMachine>().m_scrbr, " PrimaryActive" )
123+ {
124+ DECLARE_LOCALS; // 'scrbr' & 'pg_id' aliases
125+ dout (10 ) << " -- state -->> PrimaryActive" << dendl;
126+ }
127+
128+ PrimaryActive::~PrimaryActive ()
129+ {
130+ DECLARE_LOCALS; // 'scrbr' & 'pg_id' aliases
131+ // we may have set some PG state flags without reaching Session.
132+ // And we may be holding a 'local resource'.
133+ scrbr->clear_pgscrub_state ();
134+ scrbr->rm_from_osd_scrubbing ();
135+ }
136+
137+
138+ // ---------------- PrimaryActive/PrimaryIdle ---------------------------
139+
140+ PrimaryIdle::PrimaryIdle (my_context ctx)
141+ : my_base(ctx)
142+ , NamedSimply(context<ScrubMachine>().m_scrbr, " PrimaryActive/PrimaryIdle" )
143+ {
144+ dout (10 ) << " -- state -->> PrimaryActive/PrimaryIdle" << dendl;
145+ }
146+
147+ sc::result PrimaryIdle::react (const StartScrub&)
118148{
119- dout (10 ) << " NotActive ::react(const StartScrub&)" << dendl;
149+ dout (10 ) << " PrimaryIdle ::react(const StartScrub&)" << dendl;
120150 DECLARE_LOCALS;
121151 return transit<ReservingReplicas>();
122152}
123153
124- sc::result NotActive ::react (const AfterRepairScrub&)
154+ sc::result PrimaryIdle ::react (const AfterRepairScrub&)
125155{
126- dout (10 ) << " NotActive ::react(const AfterRepairScrub&)" << dendl;
156+ dout (10 ) << " PrimaryIdle ::react(const AfterRepairScrub&)" << dendl;
127157 DECLARE_LOCALS;
128158 return transit<ReservingReplicas>();
129159}
130160
161+ void PrimaryIdle::clear_state (const FullReset&) {
162+ dout (10 ) << " PrimaryIdle::react(const FullReset&): clearing state flags"
163+ << dendl;
164+ DECLARE_LOCALS;
165+ scrbr->clear_pgscrub_state ();
166+ }
167+
131168// ----------------------- Session -----------------------------------------
132169
133170Session::Session (my_context ctx)
134171 : my_base(ctx)
135- , NamedSimply(context<ScrubMachine>().m_scrbr, " Session" )
172+ , NamedSimply(context<ScrubMachine>().m_scrbr, " PrimaryActive/ Session" )
136173{
137- dout (10 ) << " -- state -->> Session" << dendl;
174+ dout (10 ) << " -- state -->> PrimaryActive/ Session" << dendl;
138175 DECLARE_LOCALS; // 'scrbr' & 'pg_id' aliases
139176
140177 // while we've checked the 'someone is reserving' flag before queueing
@@ -242,7 +279,7 @@ sc::result ReservingReplicas::react(const ReplicaReject& ev)
242279 scrbr->flag_reservations_failure ();
243280
244281 // 'Session' state dtor stops the scrubber
245- return transit<NotActive >();
282+ return transit<PrimaryIdle >();
246283}
247284
248285sc::result ReservingReplicas::react (const ReservationTimeout&)
@@ -261,7 +298,7 @@ sc::result ReservingReplicas::react(const ReservationTimeout&)
261298 // cause the scrubber to stop the scrub session, marking 'reservation
262299 // failure' as the cause (affecting future scheduling)
263300 scrbr->flag_reservations_failure ();
264- return transit<NotActive >();
301+ return transit<PrimaryIdle >();
265302}
266303
267304// ----------------------- ActiveScrubbing -----------------------------------
@@ -678,7 +715,7 @@ sc::result WaitDigestUpdate::react(const ScrubFinished&)
678715 session.m_session_started_at = ScrubTimePoint{};
679716
680717 scrbr->scrub_finish ();
681- return transit<NotActive >();
718+ return transit<PrimaryIdle >();
682719}
683720
684721ScrubMachine::ScrubMachine (PG* pg, ScrubMachineListener* pg_scrub)
@@ -813,6 +850,11 @@ ReplicaIdle::ReplicaIdle(my_context ctx)
813850 dout (10 ) << " -- state -->> ReplicaActive/ReplicaIdle" << dendl;
814851}
815852
853+ void ReplicaIdle::reset_ignored (const FullReset&)
854+ {
855+ dout (10 ) << " ReplicaIdle::react(const FullReset&): FullReset ignored"
856+ << dendl;
857+ }
816858
817859// ------------- ReplicaActive/ReplicaActiveOp --------------------------
818860
0 commit comments