diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 2bc8cce857e..2b2aa97beb0 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -921,6 +921,16 @@ void OSDService::update_osd_stat(vector& hb_peers) check_full_status(osd_stat); } +bool OSDService::check_osdmap_full(const set &missing_on) +{ + OSDMapRef osdmap = get_osdmap(); + for (auto shard : missing_on) { + if (osdmap->get_state(shard.osd) & CEPH_OSD_FULL) + return true; + } + return false; +} + void OSDService::send_message_osd_cluster(int peer, Message *m, epoch_t from_epoch) { OSDMapRef next_map = get_nextmap_reserved(); diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 591e5d2d2c7..9429640a9b5 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1181,6 +1181,7 @@ public: bool is_nearfull() const; bool need_fullness_update(); ///< osdmap state needs update void set_injectfull(s_names type, int64_t count); + bool check_osdmap_full(const set &missing_on); // -- epochs -- diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index ddd0612b131..66bb890af01 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -263,6 +263,8 @@ typedef ceph::shared_ptr OSDMapRef; virtual bool check_failsafe_full(ostream &ss) = 0; + virtual bool check_osdmap_full(const set &missing_on) = 0; + virtual ~Listener() {} }; Listener *parent; diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 9398783d867..71846caabf8 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -13031,6 +13031,11 @@ void PrimaryLogPG::_scrub_finish() } } +bool PrimaryLogPG::check_osdmap_full(const set &missing_on) +{ + return osd->check_osdmap_full(missing_on); +} + /*---SnapTrimmer Logging---*/ #undef dout_prefix #define dout_prefix *_dout << pg->gen_prefix() diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index f5b025db0e4..a7e812fe8da 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1732,6 +1732,7 @@ public: void on_removal(ObjectStore::Transaction *t) override; void on_shutdown() override; bool check_failsafe_full(ostream &ss) override; + bool check_osdmap_full(const set &missing_on) override; // attr cache handling void setattr_maybe_cache(