From f65db436f6eb83d7c59fdddced4d35dd9eeeb078 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Wed, 15 Oct 2014 15:21:11 -0700 Subject: [PATCH] ceph_objectstore_tool: Check cluster_fsid before allowing an import Signed-off-by: David Zafman (cherry picked from commit 196c8112dc9a6e8780b05d6c579cd7fbd5b07589) --- src/tools/ceph_objectstore_tool.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index f8f534726e476..3c90c3cb41f24 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -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()); -- 2.39.5