]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: set superblock compat_features on boot and mkfs
authorSamuel Just <sam.just@inktank.com>
Fri, 13 Jul 2012 23:44:33 +0000 (16:44 -0700)
committerSamuel Just <sam.just@inktank.com>
Mon, 16 Jul 2012 17:59:55 +0000 (10:59 -0700)
Previously, we did not actually persist the osd compatibility
mask.  Without persisting the current compat mask, a previous,
incompatible version of the OSD would not be prevented from
starting on the same store.

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/OSD.cc

index 054bf1b4a8f6bfe398163311ea50830ef75f8652..7fba0871b86e9e608ff22361fc33174d6b7dbdc8 100644 (file)
@@ -403,6 +403,7 @@ int OSD::mkfs(const std::string &dev, const std::string &jdev, uuid_d fsid, int
       sb.cluster_fsid = fsid;
       sb.osd_fsid = store->get_fsid();
       sb.whoami = whoami;
+      sb.compat_features = get_osd_compat_set();
 
       // benchmark?
       if (g_conf->osd_auto_weight) {
@@ -794,6 +795,17 @@ int OSD::init()
     delete store;
     return -EINVAL;
   }
+  if (osd_compat.compare(superblock.compat_features) != 0) {
+    // We need to persist the new compat_set before we
+    // do anything else
+    dout(5) << "Upgrading superblock compat_set" << dendl;
+    superblock.compat_features = osd_compat;
+    ObjectStore::Transaction t;
+    write_superblock(t);
+    r = store->apply_transaction(t);
+    if (r < 0)
+      return r;
+  }
   service.publish_superblock(superblock);
 
   class_handler = new ClassHandler();