From: Kefu Chai Date: Mon, 15 Aug 2016 07:42:29 +0000 (+0800) Subject: osd: set objecter.osdmap when starts X-Git-Tag: v10.2.3~1^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F10804%2Fhead;p=ceph.git osd: set objecter.osdmap when starts if any OSD is full or the pause flag is set in cluster, objecter will always try to subscribe the next osdmap using the mon client shared with OSD. but if the OSD's osdmap is very far behind on osd maps due to some reasons, `MonClient::sub_want_increment()` will reject the subscribe request from OSD, because it's asking for older maps while the mon client is about to send the request from objecter for the *next* osdmap. so we need to update objecter with the latest local osdmap, so it is able to skip the new osdmaps if OSD needs to catch up with the cluster first. Fixes: http://tracker.ceph.com/issues/17023 Signed-off-by: Kefu Chai (cherry picked from commit 1515e08e7d425f01d2e9d02c34b2ae40cdf2611a) --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index b85083b724f..8eb23972604 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -499,7 +499,7 @@ void OSDService::init() void OSDService::final_init() { - objecter->start(); + objecter->start(osdmap.get()); } void OSDService::activate_map() diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 2f028cf3e73..45c7e660a2d 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -358,12 +358,14 @@ void Objecter::init() /* * ok, cluster interaction can happen */ -void Objecter::start() +void Objecter::start(const OSDMap* o) { shared_lock rl(rwlock); start_tick(); - if (osdmap->get_epoch() == 0) { + if (o) { + osdmap->deepish_copy_from(*o); + } else if (osdmap->get_epoch() == 0) { _maybe_request_map(); } } diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 6b519ffd8d5..8167306dd85 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1973,7 +1973,7 @@ private: ~Objecter(); void init(); - void start(); + void start(const OSDMap *o = nullptr); void shutdown(); // These two templates replace osdmap_(get)|(put)_read. Simply wrap