]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_objectstore_tool: Check cluster_fsid before allowing an import
authorDavid Zafman <dzafman@redhat.com>
Wed, 15 Oct 2014 22:21:11 +0000 (15:21 -0700)
committerDavid Zafman <dzafman@redhat.com>
Tue, 3 Mar 2015 19:20:59 +0000 (11:20 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 196c8112dc9a6e8780b05d6c579cd7fbd5b07589)

src/tools/ceph_objectstore_tool.cc

index f8f534726e47674b7d6d539ac51bd32cb429b81d..3c90c3cb41f24a2b47121e802edea83da3b4a2e1 100644 (file)
@@ -1578,6 +1578,13 @@ int do_import(ObjectStore *store, OSDSuperblock& sb)
   pgb.decode(ebliter);
   spg_t pgid = pgb.pgid;
 
+  if (!pgb.superblock.cluster_fsid.is_zero()
+      && pgb.superblock.cluster_fsid != sb.cluster_fsid) {
+    cerr << "Export came from different cluster with fsid "
+         << pgb.superblock.cluster_fsid << std::endl;
+    return 1;
+  }
+
   if (debug) {
     cerr << "Exported features: " << pgb.superblock.compat_features << std::endl;
   }
@@ -2337,6 +2344,10 @@ int main(int argc, char **argv)
   p = bl.begin();
   ::decode(superblock, p);
 
+  if (debug) {
+    cerr << "Cluster fsid=" << superblock.cluster_fsid << std::endl;
+  }
+
 #ifdef INTERNAL_TEST2
   fs->set_allow_sharded_objects();
   assert(fs->get_allow_sharded_objects());