]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add asok command to force MDS readonly
authorYan, Zheng <zyan@redhat.com>
Fri, 28 Nov 2014 13:23:36 +0000 (21:23 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 2 Dec 2014 02:48:31 +0000 (10:48 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/MDS.cc

index 6060014d106d05ea147bfd22e322fbf8b0304f04..158602fd77578a4f1a30fd182232eb46b39e13a3 100644 (file)
@@ -299,6 +299,10 @@ bool MDS::asok_command(string command, cmdmap_t& cmdmap, string format,
     command_flush_path(f, path);
   } else if (command == "flush journal") {
     command_flush_journal(f);
+  } else if (command == "force_readonly") {
+    mds_lock.Lock();
+    mdcache->force_readonly();
+    mds_lock.Unlock();
   }
   f->flush(ss);
   delete f;
@@ -478,6 +482,11 @@ void MDS::set_up_admin_socket()
                                     asok_hook,
                                     "Flush the journal to the backing store");
   assert(0 == r);
+  r = admin_socket->register_command("force_readonly",
+                                    "force_readonly",
+                                    asok_hook,
+                                    "Force MDS to read-only mode");
+  assert(0 == r);
 }
 
 void MDS::clean_up_admin_socket()