From: Greg Farnum Date: Wed, 9 Aug 2017 21:34:44 +0000 (-0700) Subject: mdsmon: treat the osdmon correctly when doing plugged updates X-Git-Tag: v13.0.0~136^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=435717791ec499f71c9d1485b1e4e63239a343e2;p=ceph-ci.git mdsmon: treat the osdmon correctly when doing plugged updates Make sure it's writeable before invoking changes, and propose_pending() on it when we're done. Make the PaxosService::C_RetryMessage public so we can do this from FSCommands. Maybe- Fixes: http://tracker.ceph.com/issues/20959 Signed-off-by: Greg Farnum --- diff --git a/src/mon/FSCommands.cc b/src/mon/FSCommands.cc index 265a170f7dc..a8334d1164c 100644 --- a/src/mon/FSCommands.cc +++ b/src/mon/FSCommands.cc @@ -179,11 +179,6 @@ class FsNewHandler : public FileSystemCommandHandler pg_pool_t const *metadata_pool = mon->osdmon()->osdmap.get_pg_pool(metadata); assert(metadata_pool != NULL); // Checked it existed above - // we must make these checks before we even allow ourselves to *think* - // about requesting a proposal to the osdmonitor and bail out now if - // we believe we must. bailing out *after* we request the proposal is - // bad business as we could have changed the osdmon's state and ending up - // returning an error to the user. int r = _check_pool(mon->osdmon()->osdmap, data, false, force, &ss); if (r < 0) { return r; @@ -193,13 +188,20 @@ class FsNewHandler : public FileSystemCommandHandler if (r < 0) { return r; } - + + // if we're running as luminous, we have to set the pool application metadata if (mon->osdmon()->osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS || mon->osdmon()->pending_inc.new_require_osd_release >= CEPH_RELEASE_LUMINOUS) { + if (!mon->osdmon()->is_writeable()) { + // not allowed to write yet, so retry when we can + mon->osdmon()->wait_for_writeable(op, new PaxosService::C_RetryMessage(mon->mdsmon(), op)); + return -EAGAIN; + } mon->osdmon()->do_application_enable(data, pg_pool_t::APPLICATION_NAME_CEPHFS); mon->osdmon()->do_application_enable(metadata, pg_pool_t::APPLICATION_NAME_CEPHFS); + mon->osdmon()->propose_pending(); } // All checks passed, go ahead and create. diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 780a76b303e..cb1013ae374 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -3156,7 +3156,7 @@ void OSDMonitor::check_pg_creates_sub(Subscription *sub) void OSDMonitor::do_application_enable(int64_t pool_id, const std::string &app_name) { - assert(paxos->is_plugged()); + assert(paxos->is_plugged() && is_writeable()); dout(20) << __func__ << ": pool_id=" << pool_id << ", app_name=" << app_name << dendl; diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index da3038ff1e9..54e4ea3815e 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -83,17 +83,17 @@ protected: * Child must populate this during encode_pending() by calling encode_health(). */ health_check_map_t health_checks; -public: - const health_check_map_t& get_health_checks() { - return health_checks; - } - protected: /** * format of our state in leveldb, 0 for default */ version_t format_version; +public: + const health_check_map_t& get_health_checks() { + return health_checks; + } + /** * @defgroup PaxosService_h_callbacks Callback classes * @{ @@ -128,7 +128,6 @@ protected: * @} */ -public: /** * @param mn A Monitor instance * @param p A Paxos instance