]> 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:18:00 +0000 (14:18 -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>
src/osd/OSD.cc
src/osd/OSD.h

index 75f84ede5bb30bee5ac0e7504e124317b7544493..d0236e06419499b081e346f5deb26544fe088bb6 100644 (file)
@@ -4890,6 +4890,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);
@@ -6160,7 +6177,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 6576d7fdbdaa7bb0c6201244afc0326aed04df91..8bab8a990593831e09b80fdce03aa346fc7680b3 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,