]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mdsmon: treat the osdmon correctly when doing plugged updates
authorGreg Farnum <gfarnum@redhat.com>
Wed, 9 Aug 2017 21:34:44 +0000 (14:34 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Thu, 10 Aug 2017 17:28:36 +0000 (10:28 -0700)
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 <gfarnum@redhat.com>
src/mon/FSCommands.cc
src/mon/OSDMonitor.cc
src/mon/PaxosService.h

index 265a170f7dc49fd026a2e241eb1460ca1f2952b9..a8334d1164c5b048854ee68f05e503495b4438fc 100644 (file)
@@ -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.
index 780a76b303ed6e2e5d01fe0567e174d686c61dad..cb1013ae3743f865d8d34467bfca87737381e9db 100644 (file)
@@ -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;
index da3038ff1e9f9a77c6e45d453058a7bbf3ad4194..54e4ea3815e9fffcdf9be9183b187a38ef9ca732 100644 (file)
@@ -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