From 1cbc839ebd11acb2ed0ebf0b0117eab09b5141c3 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 15 Aug 2016 15:42:29 +0800 Subject: [PATCH] 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) --- src/osd/OSD.cc | 2 +- src/osdc/Objecter.cc | 6 ++++-- src/osdc/Objecter.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index b85083b724fc..8eb239726049 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 2f028cf3e73d..45c7e660a2d1 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 6b519ffd8d5a..8167306dd851 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 -- 2.47.3