]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: check OSDSuperblock in mkfs() when it already have superblock 6385/head
authorVicente Cheng <freeze.bilsted@gmail.com>
Tue, 27 Oct 2015 09:11:30 +0000 (17:11 +0800)
committerVicente Cheng <freeze.bilsted@gmail.com>
Tue, 27 Oct 2015 09:11:30 +0000 (17:11 +0800)
    When we remove the ready flag from osd directory, it will execute mkfs again.
    It will read superblock but can not check osd id and cluster fsid correctly.

    It need to decode the superblock that we read from osd.
    It will always failure now, so I modify it for read osd id and fsid correctly.

http://tracker.ceph.com/issues/13586
Fixes: #13586
Signed-off-by: Vicente Cheng <freeze.bilsted@gmail.com>
src/osd/OSD.cc

index 5ed8f67d1146eab5e1c297c871c7edf1d57f5d35..aba753184ebc41c70ac7d054ec4665805124bd47 100644 (file)
@@ -1351,7 +1351,11 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
     bufferlist sbbl;
     ret = store->read(coll_t::meta(), OSD_SUPERBLOCK_POBJECT, 0, 0, sbbl);
     if (ret >= 0) {
+      /* if we already have superblock, check content of superblock */
       dout(0) << " have superblock" << dendl;
+      bufferlist::iterator p;
+      p = sbbl.begin();
+      ::decode(sb, p);
       if (whoami != sb.whoami) {
        derr << "provided osd id " << whoami << " != superblock's " << sb.whoami << dendl;
        ret = -EINVAL;