]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PG,PeeringState: Fix initialization order
authorsjust@redhat.com <sjust@redhat.com>
Wed, 10 Apr 2019 22:56:26 +0000 (15:56 -0700)
committersjust@redhat.com <sjust@redhat.com>
Wed, 1 May 2019 18:22:28 +0000 (11:22 -0700)
PeeringState needs to be initialized last and destructed
first.

Signed-off-by: sjust@redhat.com <sjust@redhat.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/PeeringState.cc
src/osd/PeeringState.h

index 777247ccbc606ea05355a02cc3c6ef0d0654de42..ba6d8730c11ff5acf4d5d0fa7eb4a11061f47c36 100644 (file)
@@ -178,17 +178,8 @@ void PG::dump_live_ids()
 
 PG::PG(OSDService *o, OSDMapRef curmap,
        const PGPool &_pool, spg_t p) :
-  pg_whoami(osd->whoami, p.shard),
+  pg_whoami(o->whoami, p.shard),
   pg_id(p),
-  recovery_state(
-    cct,
-    pg_whoami,
-    p,
-    _pool,
-    curmap,
-    this,
-    this),
-  info(recovery_state.get_info()),
   coll(p),
   osd(o),
   cct(o->cct),
@@ -215,7 +206,16 @@ PG::PG(OSDService *o, OSDMapRef curmap,
   finish_sync_event(NULL),
   backoff_lock("PG::backoff_lock"),
   scrub_after_recovery(false),
-  active_pushes(0)
+  active_pushes(0),
+  recovery_state(
+    o->cct,
+    pg_whoami,
+    p,
+    _pool,
+    curmap,
+    this,
+    this),
+  info(recovery_state.get_info())
 {
 #ifdef PG_DEBUG_REFS
   osd->add_pgid(p, this);
index 6cc90a2fe06621ef1db337c0b0264a7e92ee9206..d9bea3b5fc3d3fd45e4dafd71bad8170d83fedcf 100644 (file)
@@ -175,16 +175,9 @@ class PG : public DoutPrefixProvider, public PeeringState::PeeringListener {
 public:
   const pg_shard_t pg_whoami;
   const spg_t pg_id;
-  PeeringState recovery_state;
 
   using PeeringCtx = PeeringState::PeeringCtx;
 
-protected:
-  /**
-   * Ref to pg_info_t in Peering state
-   */
-  const pg_info_t &info;
-
 public:
   // -- members --
   const coll_t coll;
@@ -1509,6 +1502,14 @@ protected:
   friend class FlushState;
 
   friend ostream& operator<<(ostream& out, const PG& pg);
+
+protected:
+  PeeringState recovery_state;
+
+  /**
+   * Ref to pg_info_t in Peering state
+   */
+  const pg_info_t &info;
 };
 
 
index 53a3a97f3fb42e03d2f3e72fe6ec2cc8945b9760..f87dadc968e330a9f6a93eadd99c0fffd24fc110 100644 (file)
@@ -120,7 +120,7 @@ PeeringState::PeeringState(
   DoutPrefixProvider *dpp,
   PeeringListener *pl)
   : state_history(pl),
-    machine(this, cct, spgid, dpp, pl, &state_history), cct(cct),
+    cct(cct),
     spgid(spgid),
     dpp(dpp),
     pl(pl),
@@ -130,7 +130,8 @@ PeeringState::PeeringState(
     pg_whoami(pg_whoami),
     info(spgid),
     pg_log(cct),
-    missing_loc(spgid, this, dpp, cct)
+    missing_loc(spgid, this, dpp, cct),
+    machine(this, cct, spgid, dpp, pl, &state_history)
 {
   machine.initiate();
 }
index 0ba13b960f0537124bcb616a3279eeb689c39211..a990b49cfb76fcd31760701ecf773e8b9667c9f7 100644 (file)
@@ -1138,7 +1138,6 @@ public:
   };
 
   PGStateHistory state_history;
-  PeeringMachine machine;
   CephContext* cct;
   spg_t spgid;
   DoutPrefixProvider *dpp;
@@ -1257,6 +1256,8 @@ public:
   bool backfill_reserved = false;
   bool backfill_reserving = false;
 
+  PeeringMachine machine;
+
   void update_osdmap_ref(OSDMapRef newmap) {
     osdmap_ref = std::move(newmap);
   }