From a00151ac6037275430f70c0be6eb880efd42b6e6 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Mon, 1 Apr 2019 16:52:34 -0700 Subject: [PATCH] mds: verify current release has a cephfs feature bit Fixes: http://tracker.ceph.com/issues/39077 Signed-off-by: Patrick Donnelly --- src/mds/Server.cc | 3 +++ src/mds/cephfs_features.h | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 2c5ff3f30af..beb5e1e5237 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -1362,6 +1362,9 @@ void Server::update_required_client_features() { vector bits = CEPHFS_FEATURES_MDS_REQUIRED; + /* If this blows up on you, you added a release without adding a new release bit to cephfs_features.h */ + static_assert(CEPHFS_CURRENT_RELEASE == CEPH_RELEASE_MAX-1); + int min_compat = mds->mdsmap->get_min_compat_client(); if (min_compat >= CEPH_RELEASE_NAUTILUS) { bits.push_back(CEPHFS_FEATURE_NAUTILUS); diff --git a/src/mds/cephfs_features.h b/src/mds/cephfs_features.h index 66752af2627..e2a5a6cc306 100644 --- a/src/mds/cephfs_features.h +++ b/src/mds/cephfs_features.h @@ -15,8 +15,12 @@ #ifndef CEPHFS_FEATURES_H #define CEPHFS_FEATURES_H -// Please add feature bits for later ceph releases and update -// Server::update_required_client_features(). +// When adding a new release, please update the "current" release below, add a +// feature bit for that release, add that feature bit to CEPHFS_FEATURES_ALL, +// and update Server::update_required_client_features(). This feature bit +// is used to indicate that operator only wants clients from that release or +// later to mount CephFS. +#define CEPHFS_CURRENT_RELEASE CEPH_RELEASE_OCTOPUS // The first 5 bits are reserved for old ceph releases. #define CEPHFS_FEATURE_JEWEL 5 -- 2.39.5