From: Samuel Just Date: Thu, 21 Mar 2019 19:00:09 +0000 (-0700) Subject: PeeringState: fix pg->info->pgid.pgid references X-Git-Tag: v15.1.0~2774^2~83 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=442bfd80a1e11fd0b8ab18db9652f0e3a8518136;p=ceph-ci.git PeeringState: fix pg->info->pgid.pgid references Signed-off-by: Samuel Just --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index dcb0df424cc..9850c76835e 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -364,7 +364,7 @@ PG::PG(OSDService *o, OSDMapRef curmap, backoff_lock("PG::backoff_lock"), scrub_after_recovery(false), active_pushes(0), - recovery_state(cct, this), + recovery_state(cct, info.pgid, this), peer_features(CEPH_FEATURES_SUPPORTED_DEFAULT), acting_features(CEPH_FEATURES_SUPPORTED_DEFAULT), upacting_features(CEPH_FEATURES_SUPPORTED_DEFAULT), diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index f3fdbd57f8d..a580c2fdd43 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -16,7 +16,7 @@ void PeeringState::PeeringMachine::send_query( ceph_assert(state->rctx); ceph_assert(state->rctx->query_map); (*state->rctx->query_map)[to.osd][ - spg_t(pg->info.pgid.pgid, to.shard)] = query; + spg_t(context< PeeringMachine >().spgid.pgid, to.shard)] = query; } @@ -483,7 +483,7 @@ void PeeringState::Backfilling::backfill_release_reservations() pg->osd->send_message_osd_cluster( new MBackfillReserve( MBackfillReserve::RELEASE, - spg_t(pg->info.pgid.pgid, it->shard), + spg_t(context< PeeringMachine >().spgid.pgid, it->shard), pg->get_osdmap_epoch()), con.get()); } @@ -597,7 +597,7 @@ PeeringState::WaitRemoteBackfillReserved::react(const RemoteBackfillReserved &ev pg->osd->send_message_osd_cluster( new MBackfillReserve( MBackfillReserve::REQUEST, - spg_t(pg->info.pgid.pgid, backfill_osd_it->shard), + spg_t(context< PeeringMachine >().spgid.pgid, backfill_osd_it->shard), pg->get_osdmap_epoch(), pg->get_backfill_priority(), num_bytes, @@ -639,7 +639,7 @@ void PeeringState::WaitRemoteBackfillReserved::retry() pg->osd->send_message_osd_cluster( new MBackfillReserve( MBackfillReserve::RELEASE, - spg_t(pg->info.pgid.pgid, it->shard), + spg_t(context< PeeringMachine >().spgid.pgid, it->shard), pg->get_osdmap_epoch()), con.get()); } @@ -786,7 +786,7 @@ PeeringState::RepWaitRecoveryReserved::react(const RemoteRecoveryReserved &evt) pg->primary.osd, new MRecoveryReserve( MRecoveryReserve::GRANT, - spg_t(pg->info.pgid.pgid, pg->primary.shard), + spg_t(context< PeeringMachine >().spgid.pgid, pg->primary.shard), pg->get_osdmap_epoch()), pg->get_osdmap_epoch()); return transit(); @@ -952,7 +952,7 @@ PeeringState::RepWaitBackfillReserved::react(const RemoteBackfillReserved &evt) pg->primary.osd, new MBackfillReserve( MBackfillReserve::GRANT, - spg_t(pg->info.pgid.pgid, pg->primary.shard), + spg_t(context< PeeringMachine >().spgid.pgid, pg->primary.shard), pg->get_osdmap_epoch()), pg->get_osdmap_epoch()); return transit(); @@ -1005,7 +1005,7 @@ PeeringState::RepRecovering::react(const RemoteRecoveryPreempted &) pg->primary.osd, new MRecoveryReserve( MRecoveryReserve::REVOKE, - spg_t(pg->info.pgid.pgid, pg->primary.shard), + spg_t(context< PeeringMachine >().spgid.pgid, pg->primary.shard), pg->get_osdmap_epoch()), pg->get_osdmap_epoch()); return discard_event(); @@ -1020,7 +1020,7 @@ PeeringState::RepRecovering::react(const BackfillTooFull &) pg->primary.osd, new MBackfillReserve( MBackfillReserve::TOOFULL, - spg_t(pg->info.pgid.pgid, pg->primary.shard), + spg_t(context< PeeringMachine >().spgid.pgid, pg->primary.shard), pg->get_osdmap_epoch()), pg->get_osdmap_epoch()); return discard_event(); @@ -1035,7 +1035,7 @@ PeeringState::RepRecovering::react(const RemoteBackfillPreempted &) pg->primary.osd, new MBackfillReserve( MBackfillReserve::REVOKE, - spg_t(pg->info.pgid.pgid, pg->primary.shard), + spg_t(context< PeeringMachine >().spgid.pgid, pg->primary.shard), pg->get_osdmap_epoch()), pg->get_osdmap_epoch()); return discard_event(); @@ -1133,7 +1133,7 @@ PeeringState::WaitRemoteRecoveryReserved::react(const RemoteRecoveryReserved &ev pg->osd->send_message_osd_cluster( new MRecoveryReserve( MRecoveryReserve::REQUEST, - spg_t(pg->info.pgid.pgid, remote_recovery_reservation_it->shard), + spg_t(context< PeeringMachine >().spgid.pgid, remote_recovery_reservation_it->shard), pg->get_osdmap_epoch(), pg->get_recovery_priority()), con.get()); @@ -1186,7 +1186,7 @@ void PeeringState::Recovering::release_reservations(bool cancel) pg->osd->send_message_osd_cluster( new MRecoveryReserve( MRecoveryReserve::RELEASE, - spg_t(pg->info.pgid.pgid, i->shard), + spg_t(context< PeeringMachine >().spgid.pgid, i->shard), pg->get_osdmap_epoch()), con.get()); } @@ -1268,7 +1268,7 @@ PeeringState::Recovered::Recovered(my_context ctx) // if we finished backfill, all acting are active; recheck if // DEGRADED | UNDERSIZED is appropriate. ceph_assert(!pg->acting_recovery_backfill.empty()); - if (pg->get_osdmap()->get_pg_size(pg->info.pgid.pgid) <= + if (pg->get_osdmap()->get_pg_size(context< PeeringMachine >().spgid.pgid) <= pg->acting_recovery_backfill.size()) { pg->state_clear(PG_STATE_FORCED_BACKFILL | PG_STATE_FORCED_RECOVERY); pg->publish_stats_to_osd(); @@ -1493,9 +1493,10 @@ boost::statechart::result PeeringState::Active::react(const AdvMap& advmap) /* Check for changes in pool size (if the acting set changed as a result, * this does not matter) */ - if (advmap.lastmap->get_pg_size(pg->info.pgid.pgid) != - pg->get_osdmap()->get_pg_size(pg->info.pgid.pgid)) { - if (pg->get_osdmap()->get_pg_size(pg->info.pgid.pgid) <= pg->actingset.size()) { + if (advmap.lastmap->get_pg_size(context< PeeringMachine >().spgid.pgid) != + pg->get_osdmap()->get_pg_size(context< PeeringMachine >().spgid.pgid)) { + if (pg->get_osdmap()->get_pg_size(context< PeeringMachine >().spgid.pgid) <= + pg->actingset.size()) { pg->state_clear(PG_STATE_UNDERSIZED); } else { pg->state_set(PG_STATE_UNDERSIZED); @@ -1535,12 +1536,12 @@ boost::statechart::result PeeringState::Active::react(const ActMap&) if (unfound > 0 && pg->all_unfound_are_queried_or_lost(pg->get_osdmap())) { if (pg->cct->_conf->osd_auto_mark_unfound_lost) { - pg->osd->clog->error() << pg->info.pgid.pgid << " has " << unfound + pg->osd->clog->error() << context< PeeringMachine >().spgid.pgid << " has " << unfound << " objects unfound and apparently lost, would automatically " << "mark these objects lost but this feature is not yet implemented " << "(osd_auto_mark_unfound_lost)"; } else - pg->osd->clog->error() << pg->info.pgid.pgid << " has " + pg->osd->clog->error() << context< PeeringMachine >().spgid.pgid << " has " << unfound << " objects unfound and apparently lost"; } @@ -1702,7 +1703,7 @@ boost::statechart::result PeeringState::Active::react(const QueryState& q) boost::statechart::result PeeringState::Active::react(const AllReplicasActivated &evt) { PG *pg = context< PeeringMachine >().pg; - pg_t pgid = pg->info.pgid.pgid; + pg_t pgid = context< PeeringMachine >().spgid.pgid; all_replicas_activated = true; diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index cdaa0d845a5..2cfbde01331 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -220,6 +220,7 @@ public: PeeringState *state; public: CephContext *cct; + spg_t spgid; PG *pg; utime_t event_time; @@ -233,8 +234,8 @@ public: void log_enter(const char *state_name); void log_exit(const char *state_name, utime_t duration); - PeeringMachine(PeeringState *state, CephContext *cct, PG *pg) : - state(state), cct(cct), pg(pg), event_count(0) {} + PeeringMachine(PeeringState *state, CephContext *cct, spg_t spgid, PG *pg) : + state(state), cct(cct), spgid(spgid), pg(pg), event_count(0) {} /* Accessor functions for state methods */ ObjectStore::Transaction* get_cur_transaction() { @@ -957,6 +958,7 @@ public: PeeringMachine machine; CephContext* cct; + spg_t spgid; PG *pg; /// context passed in by state machine caller @@ -973,8 +975,8 @@ public: boost::optional rctx; public: - explicit PeeringState(CephContext *cct, PG *pg) - : machine(this, cct, pg), cct(cct), pg(pg), orig_ctx(0) { + explicit PeeringState(CephContext *cct, spg_t spgid, PG *pg) + : machine(this, cct, spgid, pg), cct(cct), spgid(spgid), pg(pg), orig_ctx(0) { machine.initiate(); }