From 79ac2f79d6f0ec20278f3bbea2149720c1941537 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 8 Apr 2014 12:26:19 -0700 Subject: [PATCH] osd/PG: set CREATING pg state bit until we peer for the first time We send PG state updates to the monitor while creating a PG before the actual creation and been finalized and persisted. Because those updates do not include the CREATING bit, the mon will remove the pgid from it's creating set. If the OSD(s) crash before persisting that PG creation, the PG will never get created. Fix this by leaving the CREATING bit set on the primary as long as last_epoch_started==0. That is, until we successfully peer for the very first time. Only then do we clear the bit and tell the monitor it's duty is complete. Fixes: #8001 Signed-off-by: Sage Weil --- src/osd/PG.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 5a8f11050c6ab..e3360d53080a3 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1797,6 +1797,7 @@ void PG::all_activated_and_committed() // info.last_epoch_started is set during activate() info.history.last_epoch_started = info.last_epoch_started; + state_clear(PG_STATE_CREATING); share_pg_info(); publish_stats_to_osd(); @@ -4665,6 +4666,12 @@ void PG::start_peering_interval( reg_next_scrub(); + // set CREATING bit until we have peered for the first time. + if (is_primary() && info.history.last_epoch_started == 0) + state_set(PG_STATE_CREATING); + else + state_clear(PG_STATE_CREATING); + // did acting, up, primary|acker change? if (!lastmap) { dout(10) << " no lastmap" << dendl; -- 2.47.3