]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/: fix try_mark_clean/finish_recovery interface boundary
authorSamuel Just <sjust@redhat.com>
Wed, 3 Apr 2019 23:42:58 +0000 (16:42 -0700)
committersjust@redhat.com <sjust@redhat.com>
Wed, 1 May 2019 18:22:24 +0000 (11:22 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/PeeringState.cc
src/osd/PeeringState.h

index 39c3c28d458a5d080aed5d8dda5d06ca5b0e4024..7f6cb25c7eff3dc3ec279fb2239cb621a0e80ecf 100644 (file)
@@ -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;
index faab25bafbef5e09bcfda3db0c37546980dfcbb8..b7317b2dc0f4cf0d8bbc6bc28bfb037913619e75 100644 (file)
@@ -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();
   }
index ded307e64b5793acf20339fcbc431160ba82105f..1a8b3668f1d04362ec60a93f9da1234a3db42e20 100644 (file)
@@ -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());
 }
index c63ee6972abb13da0c88e0fe9f4cfb4aeca74d69..47085cebdd16f2d36ccc89e95a3ea691e0b83068 100644 (file)
@@ -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,