From 771a10027c85afd5661aab3f2f965c2883503d98 Mon Sep 17 00:00:00 2001 From: Alex Ainscow Date: Tue, 12 Aug 2025 17:11:30 +0100 Subject: [PATCH] tools: ceph-objectstore-tool check for invalid pgid When ceph-objecstore-tool starts, if the user has specified a pgid that does not exist, the command should exit with a helpful error message. This fixes tracker https://tracker.ceph.com/issues/72536 Signed-off-by: Alex Ainscow --- src/tools/ceph_objectstore_tool.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 299421e72692..8c0c46650d98 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -4172,6 +4172,11 @@ int main(int argc, char **argv) } if (pgidstr != "meta") { auto ch = fs->open_collection(coll_t(pgid)); + if (!ch) { + stringstream ss; + cerr << "PG '" << pgid << "' not found" << std::endl; + throw std::runtime_error(ss.str()); + } if (!ghobj.match(fs->collection_bits(ch), pgid.ps())) { stringstream ss; ss << "object " << ghobj << " not contained by pg " << pgid; -- 2.47.3