]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: do not stop mds0 unless all other nodes have also stopped
authorSage Weil <sage.weil@dreamhost.com>
Thu, 5 May 2011 22:15:03 +0000 (15:15 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Thu, 5 May 2011 22:15:03 +0000 (15:15 -0700)
If we are the root node or the tableserver, we have to shut down last.
(And even then, if we have client sessions, we can't fully shut down, we
can only kill ourselves!)

Fixes: #1048 (sorta)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/mon/MDSMonitor.cc

index f6e3aefce8d8aae157baa48d3fb96e9aac16aa8a..3d42add093cb5cef07265f7fa72d653e47d0b344 100644 (file)
@@ -684,15 +684,21 @@ bool MDSMonitor::prepare_command(MMonCommand *m)
   if (m->cmd.size() > 1) {
     if (m->cmd[1] == "stop" && m->cmd.size() > 2) {
       int who = atoi(m->cmd[2].c_str());
-      if (mdsmap.is_active(who)) {
+      if (!mdsmap.is_active(who)) {
+       r = -EEXIST;
+       ss << "mds" << who << " not active (" 
+          << ceph_mds_state_name(mdsmap.get_state(who)) << ")";
+      } else if ((mdsmap.get_root() == who ||
+                 mdsmap.get_tableserver() == who) &&
+                mdsmap.get_num_mds() > 1) {
+       r = -EBUSY;
+       ss << "can't tell the root (" << mdsmap.get_root() << ") or tableserver (" << mdsmap.get_tableserver()
+          << " to stop unless it is the last mds in the cluster";
+      } else {
        r = 0;
        uint64_t gid = pending_mdsmap.up[who];
        ss << "telling mds" << who << " " << pending_mdsmap.mds_info[gid].addr << " to stop";
        pending_mdsmap.mds_info[gid].state = MDSMap::STATE_STOPPING;
-      } else {
-       r = -EEXIST;
-       ss << "mds" << who << " not active (" 
-          << ceph_mds_state_name(mdsmap.get_state(who)) << ")";
       }
     }
     else if (m->cmd[1] == "set_max_mds" && m->cmd.size() > 2) {