]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: disallow multi-active MDS if snapshot was ever created by pre-mimic mds
authorYan, Zheng <zyan@redhat.com>
Thu, 12 Apr 2018 02:22:11 +0000 (10:22 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 19 Apr 2018 04:16:57 +0000 (12:16 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/include/ceph_fs.h
src/mds/MDSMap.h
src/mon/FSCommands.cc

index 2be246397bd9f8562ace45c8bde9d9c3bdc6681f..d0f3b9abdaf39f7a3dc687a970ec6b0f0f118bb7 100644 (file)
@@ -236,8 +236,10 @@ struct ceph_mon_subscribe_ack {
 #define CEPH_MDSMAP_ALLOW_SNAPS                  (1<<1)  /* cluster allowed to create snapshots */
 /* deprecated #define CEPH_MDSMAP_ALLOW_MULTIMDS (1<<2) cluster allowed to have >1 active MDS */
 /* deprecated #define CEPH_MDSMAP_ALLOW_DIRFRAGS (1<<3) cluster allowed to fragment directories */
+#define CEPH_MDSMAP_ALLOW_MULTIMDS_SNAPS        (1<<4)  /* cluster alllowed to enable MULTIMDS
+                                                           and SNAPS at the same time */
 
-#define CEPH_MDSMAP_DEFAULTS (0)
+#define CEPH_MDSMAP_DEFAULTS CEPH_MDSMAP_ALLOW_MULTIMDS_SNAPS
 
 /*
  * mds states
index c92cf2bff2613d40eeb0727b599dacf8f3a61948..1c30686310ebb92823ef3640f366fbef1328f7af 100644 (file)
@@ -281,6 +281,9 @@ public:
   }
   void clear_snaps_allowed() { clear_flag(CEPH_MDSMAP_ALLOW_SNAPS); }
   bool allows_snaps() const { return test_flag(CEPH_MDSMAP_ALLOW_SNAPS); }
+  bool was_snaps_ever_allowed() const { return ever_allowed_features & CEPH_MDSMAP_ALLOW_SNAPS; }
+
+  bool allows_multimds_snaps() const { return test_flag(CEPH_MDSMAP_ALLOW_MULTIMDS_SNAPS); }
 
   epoch_t get_epoch() const { return epoch; }
   void inc_epoch() { epoch++; }
index 09c4892dd2de83ea444909c9ccb5dfd5e23298ed..25792b97610a8d6342ddbb5dbf03665968ab188b 100644 (file)
@@ -261,7 +261,15 @@ public:
       if (n <= 0) {
         ss << "You must specify at least one MDS";
         return -EINVAL;
-      } else if (n > MAX_MDS) {
+      }
+      if (n > 1 && n > fs->mds_map.get_max_mds()) {
+       if (fs->mds_map.was_snaps_ever_allowed() &&
+           !fs->mds_map.allows_multimds_snaps()) {
+         ss << "multi-active MDS is not allowed while there are snapshots possibly created by pre-mimic MDS";
+         return -EINVAL;
+       }
+      }
+      if (n > MAX_MDS) {
         ss << "may not have more than " << MAX_MDS << " MDS ranks";
         return -EINVAL;
       }