Merge pull request #44550 from jdurgin/wip-pool-get-quota

mon/OSDMonitor: avoid null dereference if stats are not available

Reviewed-by: Neha Ojha <nojha@redhat.com>
This commit is contained in:
Yuri Weinstein 2022-01-14 10:46:49 -08:00 committed by GitHub
commit 8b1568832d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6578,6 +6578,11 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op)
}
const pg_pool_t *p = osdmap.get_pg_pool(poolid);
const pool_stat_t* pstat = mon.mgrstatmon()->get_pool_stat(poolid);
if (!pstat) {
ss << "no stats for pool '" << pool_name << "'";
r = -ENOENT;
goto reply;
}
const object_stat_sum_t& sum = pstat->stats.sum;
if (f) {
f->open_object_section("pool_quotas");