]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/MDSTable: gracefully suicide on EBLACKLIST
authorSage Weil <sage@inktank.com>
Fri, 5 Jul 2013 18:04:17 +0000 (11:04 -0700)
committerSage Weil <sage@inktank.com>
Fri, 5 Jul 2013 18:04:37 +0000 (11:04 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/mds/MDSTable.cc
src/mds/MDSTable.h

index b90755c18546f0758519cfefc68353508847c86a..4b21f4feaa5c9ba8389782f9a39c60acbe590b98 100644 (file)
@@ -36,8 +36,7 @@ class C_MT_Save : public Context {
 public:
   C_MT_Save(MDSTable *i, version_t v) : ida(i), version(v) {}
   void finish(int r) {
-    assert(r >= 0);
-    ida->save_2(version);
+    ida->save_2(r, version);
   }
 };
 
@@ -72,10 +71,18 @@ void MDSTable::save(Context *onfinish, version_t v)
                            NULL, new C_MT_Save(this, version));
 }
 
-void MDSTable::save_2(version_t v)
+void MDSTable::save_2(int r, version_t v)
 {
   dout(10) << "save_2 v " << v << dendl;
-  
+  if (r == -EBLACKLISTED) {
+    mds->suicide();
+    return;
+  }
+  if (r < 0) {
+    dout(10) << "save_2 could not write table: " << r << dendl;
+    assert(r >= 0);
+  }
+  assert(r >= 0);
   committed_version = v;
   
   list<Context*> ls;
@@ -136,21 +143,22 @@ void MDSTable::load_2(int r, bufferlist& bl, Context *onfinish)
 {
   assert(is_opening());
   state = STATE_ACTIVE;
-
-  if (r >= 0) {
-    dout(10) << "load_2 got " << bl.length() << " bytes" << dendl;
-    bufferlist::iterator p = bl.begin();
-    ::decode(version, p);
-    projected_version = committed_version = version;
-    dout(10) << "load_2 loaded v" << version << dendl;
-    decode_state(p);
+  if (r == -EBLACKLISTED) {
+    mds->suicide();
+    return;
   }
-  else {
-    dout(10) << "load_2 could not read table; error: " << r << dendl;
-    assert(0); // this shouldn't happen if mkfs finished.
-    reset();   
+  if (r < 0) {
+    dout(10) << "load_2 could not read table: " << r << dendl;
+    assert(r >= 0);
   }
 
+  dout(10) << "load_2 got " << bl.length() << " bytes" << dendl;
+  bufferlist::iterator p = bl.begin();
+  ::decode(version, p);
+  projected_version = committed_version = version;
+  dout(10) << "load_2 loaded v" << version << dendl;
+  decode_state(p);
+
   if (onfinish) {
     onfinish->finish(0);
     delete onfinish;
index 42225651522e6633c9a5a3cd06e275f00b70f44c..f258cf9d5bf0b656c7f22d3b3bb262443d43c146 100644 (file)
@@ -67,7 +67,7 @@ public:
 
   void reset();
   void save(Context *onfinish=0, version_t need=0);
-  void save_2(version_t v);
+  void save_2(int r, version_t v);
 
   void shutdown() {
     if (is_active()) save(0);