From: David Zafman Date: Wed, 10 Jan 2018 21:30:41 +0000 (-0800) Subject: osd: Don't start recovery for missing until active pg state set X-Git-Tag: v13.0.2~511^2~4 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=64047e1bac2e775a06423a03cfab69b88462538c;p=ceph.git osd: Don't start recovery for missing until active pg state set I was seeing recovery hang when it is started before _activate_committed() The state machine passes into "Active" but this transitions to activating pg state and after commmitted into "active" pg state. Signed-off-by: David Zafman --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index ac1bfe6a98744..e873fa6087a6b 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -7093,6 +7093,7 @@ PG::RecoveryState::Recovering::Recovering(my_context ctx) pg->state_clear(PG_STATE_RECOVERY_WAIT); pg->state_clear(PG_STATE_RECOVERY_TOOFULL); pg->state_set(PG_STATE_RECOVERING); + assert(!pg->state_test(PG_STATE_ACTIVATING)); pg->publish_stats_to_osd(); pg->queue_recovery(); } @@ -7549,7 +7550,8 @@ boost::statechart::result PG::RecoveryState::Active::react(const MLogRec& logevt pg->peer_missing[logevt.from], logevt.from, context< RecoveryMachine >().get_recovery_ctx()); - if (got_missing) { + // If there are missing AND we are "fully" active then start recovery now + if (got_missing && pg->state_test(PG_STATE_ACTIVE)) { post_event(DoRecovery()); } return discard_event();