]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
MDSMonitor: check for duplicated fs creation *before* multiple-fs creation 8073/head
authorGreg Farnum <gfarnum@redhat.com>
Fri, 11 Mar 2016 22:30:53 +0000 (14:30 -0800)
committerJohn Spray <john.spray@redhat.com>
Tue, 15 Mar 2016 13:22:20 +0000 (13:22 +0000)
If we check for creating an FS with one already existing first, we will
reject (with EINVAL) duplicate attempts to create the same FS with
the same params. That makes it non-idempotent, which is bad!

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/mon/MDSMonitor.cc

index a680be73c71550f61dd0d1198f44ec482a6fe2bc..b41bc0115ae6725b6291c7bc57b165ae499f0e25 100644 (file)
@@ -1568,14 +1568,6 @@ int MDSMonitor::management_command(
         return -EINVAL;
     }
 
-    if (pending_fsmap.any_filesystems()
-        && !pending_fsmap.get_enable_multiple()) {
-      ss << "Creation of multiple filesystems is disabled.  To enable "
-            "this experimental feature, use 'ceph fs flag set enable_multiple "
-            "true'";
-      return -EINVAL;
-    }
-
     if (pending_fsmap.get_filesystem(fs_name)) {
       auto fs = pending_fsmap.get_filesystem(fs_name);
       if (*(fs->mds_map.data_pools.begin()) == data
@@ -1589,6 +1581,14 @@ int MDSMonitor::management_command(
       }
     }
 
+    if (pending_fsmap.any_filesystems()
+        && !pending_fsmap.get_enable_multiple()) {
+      ss << "Creation of multiple filesystems is disabled.  To enable "
+            "this experimental feature, use 'ceph fs flag set enable_multiple "
+            "true'";
+      return -EINVAL;
+    }
+
     pg_pool_t const *data_pool = mon->osdmon()->osdmap.get_pg_pool(data);
     assert(data_pool != NULL);  // Checked it existed above
     pg_pool_t const *metadata_pool = mon->osdmon()->osdmap.get_pg_pool(metadata);