]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
objecter: don't send duplicate onetime sub requests
authorSage Weil <sage@newdream.net>
Thu, 8 Oct 2009 18:44:17 +0000 (11:44 -0700)
committerSage Weil <sage@newdream.net>
Thu, 8 Oct 2009 18:44:17 +0000 (11:44 -0700)
src/mon/MonClient.h
src/osdc/Objecter.cc

index c44182c5b53d0f6514919d248d28924415e8d276..81df9efaacc8c00e8f5a34dfc69690412bbcbc6c 100644 (file)
@@ -98,11 +98,13 @@ private:
     sub_have[what].have = have;
     sub_have[what].onetime = false;
   }
-  void _sub_want_onetime(nstring what, version_t have) {
+  bool _sub_want_onetime(nstring what, version_t have) {
     if (sub_have.count(what) == 0) {
       sub_have[what].have = have;
       sub_have[what].onetime = true;
+      return true;
     }
+    return false;
   }
   void _sub_got(nstring what, version_t have) {
     if (sub_have.count(what)) {
@@ -122,9 +124,9 @@ public:
     Mutex::Locker l(monc_lock);
     _sub_want(what, have);
   }
-  void sub_want_onetime(nstring what, version_t have) {
+  bool sub_want_onetime(nstring what, version_t have) {
     Mutex::Locker l(monc_lock);
-    _sub_want_onetime(what, have);
+    return _sub_want_onetime(what, have);
   }
   void sub_got(nstring what, version_t have) {
     Mutex::Locker l(monc_lock);
index 2cd8dac0744d68c2d371fba478142d8f4217aea3..619e2a5a331b302ef90da2da2c3b6b21ef0206b9 100644 (file)
@@ -198,8 +198,8 @@ void Objecter::handle_osd_map(MOSDMap *m)
 void Objecter::maybe_request_map()
 {
   dout(10) << "maybe_request_map subscribing (onetime) to next osd map" << dendl;
-  monc->sub_want_onetime("osdmap", osdmap->get_epoch());
-  monc->renew_subs();
+  if (monc->sub_want_onetime("osdmap", osdmap->get_epoch()))
+    monc->renew_subs();
 }