From: Sage Weil Date: Tue, 8 Apr 2014 19:26:19 +0000 (-0700) Subject: osd/PG: set CREATING pg state bit until we peer for the first time X-Git-Tag: v0.80-rc1~72^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1627%2Fhead;p=ceph.git 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 --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 5a8f11050c6a..e3360d53080a 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;