From: Alex Ainscow Date: Tue, 12 Aug 2025 16:11:30 +0000 (+0100) Subject: tools: ceph-objectstore-tool check for invalid pgid X-Git-Tag: v21.0.0~50^2~167^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=771a10027c85afd5661aab3f2f965c2883503d98;p=ceph.git 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 --- 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;