From 90381dc9a147b1195f4682298e4db1367737c8e6 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Fri, 13 Jul 2012 16:44:33 -0700 Subject: [PATCH] OSD: set superblock compat_features on boot and mkfs 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 --- src/osd/OSD.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 054bf1b4a8f6b..7fba0871b86e9 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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(); -- 2.39.5