]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: for old osds, dispatch peering messages immediately
authorSamuel Just <sam.just@inktank.com>
Thu, 3 Jan 2013 17:59:45 +0000 (09:59 -0800)
committerSamuel Just <sam.just@inktank.com>
Thu, 3 Jan 2013 22:32:28 +0000 (14:32 -0800)
Normally, we batch up peering messages until the end of
process_peering_events to allow us to combine many notifies, etc
to the same osd into the same message.  However, old osds assume
that the actiavtion message (log or info) will be _dispatched
before the first sub_op_modify of the interval.  Thus, for those
peers, we need to send the peering messages before we drop the
pg lock, lest we issue a client repop from another thread before
activation message is sent.

Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 4ae4dce5c5bb547c1ff54d07c8b70d287490cae9)

src/osd/OSD.cc
src/osd/OSD.h

index b27de7d1f9aca013dea2a75292c5a26867b12ffb..3830d9b31922b8c99001bc21e0e895b9fe92fa60 100644 (file)
@@ -4900,6 +4900,23 @@ void OSD::dispatch_context_transaction(PG::RecoveryCtx &ctx, PG *pg)
   }
 }
 
+bool OSD::compat_must_dispatch_immediately(PG *pg)
+{
+  assert(pg->is_locked());
+  for (vector<int>::iterator i = pg->acting.begin();
+       i != pg->acting.end();
+       ++i) {
+    if (*i == whoami)
+      continue;
+    ConnectionRef conn =
+      service.get_con_osd_cluster(*i, pg->get_osdmap()->get_epoch());
+    if (conn && !(conn->features & CEPH_FEATURE_INDEP_PG_MAP)) {
+      return true;
+    }
+  }
+  return false;
+}
+
 void OSD::dispatch_context(PG::RecoveryCtx &ctx, PG *pg, OSDMapRef curmap)
 {
   do_notifies(*ctx.notify_list, curmap);
@@ -6164,7 +6181,12 @@ void OSD::process_peering_events(const list<PG*> &pgs)
       rctx.on_applied->add(new C_CompleteSplits(this, split_pgs));
       split_pgs.clear();
     }
-    dispatch_context_transaction(rctx, pg);
+    if (compat_must_dispatch_immediately(pg)) {
+      dispatch_context(rctx, pg, curmap);
+      rctx = create_context();
+    } else {
+      dispatch_context_transaction(rctx, pg);
+    }
     pg->unlock();
   }
   if (need_up_thru)
index a843fd41e295ff8cfee82e7c874a35a9413d617b..88b24dfa1fba4d9eef9217c520b0233175aba77c 100644 (file)
@@ -969,6 +969,7 @@ protected:
 
   // -- generic pg peering --
   PG::RecoveryCtx create_context();
+  bool compat_must_dispatch_immediately(PG *pg);
   void dispatch_context(PG::RecoveryCtx &ctx, PG *pg, OSDMapRef curmap);
   void dispatch_context_transaction(PG::RecoveryCtx &ctx, PG *pg);
   void do_notifies(map< int,vector<pair<pg_notify_t, pg_interval_map_t> > >& notify_list,