From fa4e2a0442ca5ab34f6ffb413d00fe66e36b31ef Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 8 Oct 2009 11:44:17 -0700 Subject: [PATCH] objecter: don't send duplicate onetime sub requests --- src/mon/MonClient.h | 8 +++++--- src/osdc/Objecter.cc | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index c44182c5b53d0..81df9efaacc8c 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -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); diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 2cd8dac0744d6..619e2a5a331b3 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -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(); } -- 2.39.5