From: Samuel Just Date: Wed, 3 Apr 2019 23:42:58 +0000 (-0700) Subject: osd/: fix try_mark_clean/finish_recovery interface boundary X-Git-Tag: v15.1.0~2774^2~35 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=985c7f6b87ce3a52fefc19485a949303ec494277;p=ceph-ci.git osd/: fix try_mark_clean/finish_recovery interface boundary Signed-off-by: Samuel Just --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 39c3c28d458..7f6cb25c7ef 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -501,48 +501,6 @@ unsigned PG::get_scrub_priority() return pool_scrub_priority > 0 ? pool_scrub_priority : cct->_conf->osd_scrub_priority; } -void PG::try_mark_clean() -{ - if (actingset.size() == get_osdmap()->get_pg_size(info.pgid.pgid)) { - state_clear(PG_STATE_FORCED_BACKFILL | PG_STATE_FORCED_RECOVERY); - state_set(PG_STATE_CLEAN); - info.history.last_epoch_clean = get_osdmap_epoch(); - info.history.last_interval_clean = info.history.same_interval_since; - past_intervals.clear(); - dirty_big_info = true; - dirty_info = true; - } - - if (is_active()) { - kick_snap_trim(); - } else if (is_peered()) { - if (is_clean()) { - bool target; - if (pool.info.is_pending_merge(info.pgid.pgid, &target)) { - if (target) { - ldout(cct, 10) << "ready to merge (target)" << dendl; - osd->set_ready_to_merge_target(this, - info.last_update, - info.history.last_epoch_started, - info.history.last_epoch_clean); - } else { - ldout(cct, 10) << "ready to merge (source)" << dendl; - osd->set_ready_to_merge_source(this, info.last_update); - } - } - } else { - ldout(cct, 10) << "not clean, not ready to merge" << dendl; - // we should have notified OSD in Active state entry point - } - } - - state_clear(PG_STATE_FORCED_RECOVERY | PG_STATE_FORCED_BACKFILL); - - recovery_state.share_pg_info(); - publish_stats_to_osd(); - requeue_ops(waiting_for_clean_to_primary_repair); -} - Context *PG::finish_recovery() { dout(10) << "finish_recovery" << dendl; diff --git a/src/osd/PG.h b/src/osd/PG.h index faab25bafbe..b7317b2dc0f 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -460,7 +460,10 @@ public: void on_active_exit() override; Context *on_clean() override { - try_mark_clean(); + if (is_active()) { + kick_snap_trim(); + } + requeue_ops(waiting_for_clean_to_primary_repair); return finish_recovery(); } @@ -998,8 +1001,6 @@ protected: friend class TestOpsSocketHook; void publish_stats_to_osd() override; - void try_mark_clean(); ///< mark an active pg clean - bool needs_recovery() const { return recovery_state.needs_recovery(); } diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index ded307e64b5..1a8b3668f1d 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -2579,6 +2579,45 @@ void PeeringState::fulfill_query(const MQuery& query, PeeringCtx *rctx) } } +void PeeringState::try_mark_clean() +{ + if (actingset.size() == get_osdmap()->get_pg_size(info.pgid.pgid)) { + state_clear(PG_STATE_FORCED_BACKFILL | PG_STATE_FORCED_RECOVERY); + state_set(PG_STATE_CLEAN); + info.history.last_epoch_clean = get_osdmap_epoch(); + info.history.last_interval_clean = info.history.same_interval_since; + past_intervals.clear(); + dirty_big_info = true; + dirty_info = true; + } + + if (!is_active() && is_peered()) { + if (is_clean()) { + bool target; + if (pool.info.is_pending_merge(info.pgid.pgid, &target)) { + if (target) { + psdout(10) << "ready to merge (target)" << dendl; + pl->set_ready_to_merge_target( + info.last_update, + info.history.last_epoch_started, + info.history.last_epoch_clean); + } else { + psdout(10) << "ready to merge (source)" << dendl; + pl->set_ready_to_merge_source(info.last_update); + } + } + } else { + psdout(10) << "not clean, not ready to merge" << dendl; + // we should have notified OSD in Active state entry point + } + } + + state_clear(PG_STATE_FORCED_RECOVERY | PG_STATE_FORCED_BACKFILL); + + share_pg_info(); + pl->publish_stats_to_osd(); +} + /*------------ Peering State Machine----------------*/ #undef dout_prefix #define dout_prefix (context< PeeringMachine >().dpp->gen_prefix(*_dout) \ @@ -3837,6 +3876,9 @@ PeeringState::Clean::Clean(my_context ctx) if (ps->info.last_complete != ps->info.last_update) { ceph_abort(); } + + ps->try_mark_clean(); + context< PeeringMachine >().get_cur_transaction()->register_on_commit( pl->on_clean()); } diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index c63ee6972ab..47085cebdd1 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -1403,6 +1403,8 @@ public: pg_shard_t from, const pg_query_t &query, epoch_t query_epoch); void fulfill_query(const MQuery& q, PeeringCtx *rctx); + void try_mark_clean(); + public: PeeringState( CephContext *cct,