From f88b3534549bb2ede76e9f3e8b6b641b5886a9f4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 20 Sep 2019 14:16:30 -0500 Subject: [PATCH] ceph-objectstore-tool: better error message if pgid and object do not match Fixes: https://tracker.ceph.com/issues/41913 Signed-off-by: Sage Weil --- src/tools/ceph_objectstore_tool.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 1830f7e1681..5e2057f54da 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -3758,6 +3758,12 @@ int main(int argc, char **argv) ret = 1; goto out; } + auto ch = fs->open_collection(coll_t(pgid)); + if (!ghobj.match(fs->collection_bits(ch), pgid.ps())) { + stringstream ss; + ss << "object " << ghobj << " not contained by pg " << pgid; + throw std::runtime_error(ss.str()); + } } } catch (std::runtime_error& e) { cerr << e.what() << std::endl; -- 2.39.5