]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix _activate_committed replica->primary message
authorSage Weil <sage@newdream.net>
Wed, 15 Feb 2012 21:16:25 +0000 (13:16 -0800)
committerSage Weil <sage@newdream.net>
Fri, 17 Feb 2012 05:00:35 +0000 (21:00 -0800)
Normally we take a fresh map reference in PG::lock().  However,
_activate_committed needs to make sure the map hasn't changed significantly
before acting.  In the case of #2068, the OSD map has moved forward and
the mapping has changed, but the PG hasn't processed that yet, and thus
mis-tags the MOSDPGInfo message.

Tag the message with the e epoch, and also pass down the primary's address
to send the message to the right location.

Fixes: #2068
Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/PG.cc
src/osd/PG.h

index 132aaa168440b2a9c87fc539e2156408dd8eaa68..47e62bb288f9be3f77ffc8cce8c99aae49cefe30 100644 (file)
@@ -1161,9 +1161,10 @@ void PG::build_might_have_unfound()
 struct C_PG_ActivateCommitted : public Context {
   PG *pg;
   epoch_t epoch;
-  C_PG_ActivateCommitted(PG *p, epoch_t e) : pg(p), epoch(e) {}
+  entity_inst_t primary;
+  C_PG_ActivateCommitted(PG *p, epoch_t e, entity_inst_t pi) : pg(p), epoch(e), primary(pi) {}
   void finish(int r) {
-    pg->_activate_committed(epoch);
+    pg->_activate_committed(epoch, primary);
   }
 };
 
@@ -1220,7 +1221,8 @@ void PG::activate(ObjectStore::Transaction& t, list<Context*>& tfin,
 
   // find out when we commit
   get();   // for callback
-  tfin.push_back(new C_PG_ActivateCommitted(this, info.history.same_interval_since));
+  tfin.push_back(new C_PG_ActivateCommitted(this, info.history.same_interval_since,
+                                           get_osdmap()->get_inst(acting[0])));
   
   // initialize snap_trimq
   if (is_primary()) {
@@ -1453,7 +1455,7 @@ void PG::replay_queued_ops()
   update_stats();
 }
 
-void PG::_activate_committed(epoch_t e)
+void PG::_activate_committed(epoch_t e, entity_inst_t& primary)
 {
   lock();
   if (e < last_peering_reset) {
@@ -1467,9 +1469,7 @@ void PG::_activate_committed(epoch_t e)
       all_activated_and_committed();
   } else {
     dout(10) << "_activate_committed " << e << " telling primary" << dendl;
-    epoch_t cur_epoch = get_osdmap()->get_epoch();
-    entity_inst_t primary = get_osdmap()->get_cluster_inst(acting[0]);
-    MOSDPGInfo *m = new MOSDPGInfo(cur_epoch);
+    MOSDPGInfo *m = new MOSDPGInfo(e);
     pg_info_t i = info;
     i.history.last_epoch_started = e;
     m->pg_info.push_back(i);
index a8976991732c19e8453c5e7f43ebe881945fc191..e37cb8535e92fa4627497f067ef62d990465812a 100644 (file)
@@ -723,7 +723,7 @@ public:
   void activate(ObjectStore::Transaction& t, list<Context*>& tfin,
                map< int, map<pg_t,pg_query_t> >& query_map,
                map<int, MOSDPGInfo*> *activator_map=0);
-  void _activate_committed(epoch_t e);
+  void _activate_committed(epoch_t e, entity_inst_t& primary);
   void all_activated_and_committed();
 
   void proc_primary_info(ObjectStore::Transaction &t, const pg_info_t &info);