]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
PeeringState: fix pg->info->pgid.pgid references
authorSamuel Just <sjust@redhat.com>
Thu, 21 Mar 2019 19:00:09 +0000 (12:00 -0700)
committersjust@redhat.com <sjust@redhat.com>
Wed, 1 May 2019 18:22:11 +0000 (11:22 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PG.cc
src/osd/PeeringState.cc
src/osd/PeeringState.h

index dcb0df424cc5e19343b4e4b2538c94dce5d59337..9850c76835e805912b45d2a1a6a5f87b049e64b1 100644 (file)
@@ -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),
index f3fdbd57f8dcd4295c44f5bc91489a3a63357a3b..a580c2fdd43b4d3134f0d96d6146c6bfb4d3ec0c 100644 (file)
@@ -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<RepRecovering>();
@@ -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<RepRecovering>();
@@ -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;
 
index cdaa0d845a5ac00eeae4252038aed9c8494072f3..2cfbde01331c916499ae3bc7f6ff85382c0e9895 100644 (file)
@@ -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<PeeringCtx> 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();
   }