]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Warn and shutdown on a mismatched fsid, instead of failing an assert
authorGreg Farnum <gregf@hq.newdream.net>
Mon, 21 Jun 2010 16:45:43 +0000 (09:45 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Mon, 21 Jun 2010 16:46:22 +0000 (09:46 -0700)
src/osd/OSD.cc
src/osd/OSDMap.h

index 881db35f476936fc52bcb536d308ea5286992454..10ad4b4c128cfac305fb9e35f1bb010895fb2eda 100644 (file)
@@ -2172,7 +2172,13 @@ void OSD::handle_osd_map(MOSDMap *m)
 
       bufferlist::iterator p = bl.begin();
       inc.decode(p);
-      osdmap->apply_incremental(inc);
+      if (osdmap->apply_incremental(inc)) {
+       //error out!
+       dout(0) << "ERROR: Got non-matching FSID from trusted source!" << dendl;
+       session->put();
+       m->put();
+       shutdown();
+      }
 
       // archive the full map
       bl.clear();
index 1ca3f6883b962183832d68e0ad164c6c62945332..e780925cedbf83821bec5e7ab210b1b5c8627cfc 100644 (file)
@@ -475,11 +475,13 @@ private:
   }
 
 
-  void apply_incremental(Incremental &inc) {
+  int apply_incremental(Incremental &inc) {
     if (inc.epoch == 1)
       fsid = inc.fsid;
     else
-      assert(ceph_fsid_compare(&inc.fsid, &fsid) == 0);
+      if (ceph_fsid_compare(&inc.fsid, &fsid) == 0) {
+       return -EINVAL;
+      }
     assert(inc.epoch == epoch+1);
     epoch++;
     modified = inc.modified;
@@ -487,7 +489,7 @@ private:
     // full map?
     if (inc.fullmap.length()) {
       decode(inc.fullmap);
-      return;
+      return 0;
     }
 
     // nope, incremental.
@@ -586,6 +588,7 @@ private:
       bufferlist::iterator blp = inc.crush.begin();
       crush.decode(blp);
     }
+    return 0;
   }
 
   // serialize, unserialize