]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: ceph-objectstore-tool check for invalid pgid 64987/head
authorAlex Ainscow <aainscow@uk.ibm.com>
Tue, 12 Aug 2025 16:11:30 +0000 (17:11 +0100)
committerAlex Ainscow <aainscow@uk.ibm.com>
Tue, 12 Aug 2025 16:13:39 +0000 (17:13 +0100)
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 <aainscow@uk.ibm.com>
src/tools/ceph_objectstore_tool.cc

index 299421e726928338459c402d4d2e9c074f6d1d2f..8c0c46650d983a76ec69cff87b6ac0bde7c1f927 100644 (file)
@@ -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;