]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
objecter: fix osdmap wait
authorSage Weil <sage@inktank.com>
Tue, 4 Sep 2012 18:29:21 +0000 (11:29 -0700)
committerSage Weil <sage@inktank.com>
Tue, 4 Sep 2012 18:29:21 +0000 (11:29 -0700)
When we get a pool_op_reply, we find out which osdmap we need to wait for.
The wait_for_new_map() code was feeding that epoch into
maybe_request_map(), which was feeding it to the monitor with the subscribe
request.  However, that epoch is the *start* epoch, not what we want.  Fix
this code to always subscribe to what we have (+1), and ensure we keep
asking for more until we catch up to what we know we should eventually
get.

Bug: #3075
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 48c07d112d7fb0b2d2d9c0a293aee2589f312f48..ecbf8bc62ff37b44594b433d5fd92e20fbfa0e55 100644 (file)
@@ -593,6 +593,9 @@ void Objecter::handle_osd_map(MOSDMap *m)
   m->put();
 
   monc->sub_got("osdmap", osdmap->get_epoch());
+
+  if (!waiting_for_map.empty())
+    maybe_request_map();
 }
 
 void Objecter::C_Op_Map_Latest::finish(int r)
@@ -749,7 +752,7 @@ void Objecter::wait_for_osd_map()
 }
 
 
-void Objecter::maybe_request_map(epoch_t epoch)
+void Objecter::maybe_request_map()
 {
   int flag = 0;
   if (osdmap->test_flag(CEPH_OSDMAP_FULL)) {
@@ -758,13 +761,16 @@ void Objecter::maybe_request_map(epoch_t epoch)
     ldout(cct, 10) << "maybe_request_map subscribing (onetime) to next osd map" << dendl;
     flag = CEPH_SUBSCRIBE_ONETIME;
   }
-  if (!epoch) {
-    epoch = osdmap->get_epoch() ? osdmap->get_epoch()+1 : 0;
-  }
+  epoch_t epoch = osdmap->get_epoch() ? osdmap->get_epoch()+1 : 0;
   if (monc->sub_want("osdmap", epoch, flag))
     monc->renew_subs();
 }
 
+void Objecter::wait_for_new_map(Context *c, epoch_t epoch, int err)
+{
+  waiting_for_map[epoch].push_back(pair<Context *, int>(c, err));
+  maybe_request_map();
+}
 
 void Objecter::kick_requests(OSDSession *session)
 {
index f15ba82d40deabb1c0fa798d566126b7cb62c8da..47f126871fbcd4fe443cdbd2bd0a190cc2e52ca3 100644 (file)
@@ -523,7 +523,7 @@ class Objecter {
   bool keep_balanced_budget;
   bool honor_osdmap_full;
 
-  void maybe_request_map(epoch_t epoch=0);
+  void maybe_request_map();
 
   version_t last_seen_osdmap_version;
   version_t last_seen_pgmap_version;
@@ -997,10 +997,7 @@ private:
   int get_client_incarnation() const { return client_inc; }
   void set_client_incarnation(int inc) { client_inc = inc; }
 
-  void wait_for_new_map(Context *c, epoch_t epoch, int replyCode=0) {
-    maybe_request_map(epoch);
-    waiting_for_map[epoch].push_back(pair<Context *, int>(c, replyCode));
-  }
+  void wait_for_new_map(Context *c, epoch_t epoch, int err=0);
 
   /** Get the current set of global op flags */
   int get_global_op_flags() { return global_op_flags; }