]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: verify fsid whoami to match on repeat mkfs
authorSage Weil <sage@inktank.com>
Tue, 22 May 2012 18:41:25 +0000 (11:41 -0700)
committerSage Weil <sage@inktank.com>
Wed, 23 May 2012 23:31:43 +0000 (16:31 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OSD.cc

index 7c7ba3d6a3560f2ae2224f07bbe950bb9da31649..c25d5e014684017b708fd50d220f9c7faffff79a 100644 (file)
@@ -305,6 +305,16 @@ int OSD::mkfs(const std::string &dev, const std::string &jdev, uuid_d fsid, int
     ret = store->read(coll_t::META_COLL, OSD_SUPERBLOCK_POBJECT, 0, 0, sbbl);
     if (ret >= 0) {
       dout(0) << " have superblock" << dendl;
+      if (whoami != sb.whoami) {
+       derr << "provided osd id " << whoami << " != superblock's " << sb.whoami << dendl;
+       ret = -EINVAL;
+       goto umount_store;
+      }
+      if (fsid != sb.cluster_fsid) {
+       derr << "provided cluster fsid " << fsid << " != superblock's " << sb.cluster_fsid << dendl;
+       ret = -EINVAL;
+       goto umount_store;
+      }
     } else {
       // create superblock
       if (fsid.is_zero()) {