From: Kefu Chai Date: Fri, 2 Jun 2017 04:43:07 +0000 (+0800) Subject: mon/OSDMonitor: filter the added creating_pgs added from pgmap X-Git-Tag: ses5-milestone6~8^2~19^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=befe07f197624f9740e1452d85e2eb2a31e95c5e;p=ceph.git mon/OSDMonitor: filter the added creating_pgs added from pgmap the creating_pgs added from pgmap might contains pgs whose containing pools have been deleted. this is fine with the PGMonitor, as it has the updated pg mapping which is consistent with itself. but it does not work with OSDMonitor's creating_pgs, whose pg mapping is calculated by itself. so we need to filter the pgmap's creating_pgs when adding them to OSDMonitor's creating_pgs with the latest osdmap.get_pools(). Fixes: http://tracker.ceph.com/issues/20067 Signed-off-by: Kefu Chai --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 6924efb2c6a..624c1c0ba34 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -955,6 +955,7 @@ OSDMonitor::update_pending_pgs(const OSDMap::Incremental& inc) osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) { auto added = mon->pgservice->maybe_add_creating_pgs(creating_pgs.last_scan_epoch, + osdmap.get_pools(), &pending_creatings); dout(7) << __func__ << " " << added << " pgs added from pgmap" << dendl; } diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 1fe56a1c5f6..fc46cbf92d0 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1209,12 +1209,17 @@ public: return pgmap.creating_pgs.count(pgid); } unsigned maybe_add_creating_pgs(epoch_t scan_epoch, - creating_pgs_t *pending_creates) const override { + const mempool::osdmap::map& pools, + creating_pgs_t *pending_creates) const override + { if (pgmap.last_pg_scan < scan_epoch) { return 0; } unsigned added = 0; for (auto& pgid : pgmap.creating_pgs) { + if (!pools.count(pgid.pool())) { + continue; + } auto st = pgmap.pg_stat.find(pgid); assert(st != pgmap.pg_stat.end()); auto created = make_pair(st->second.created, diff --git a/src/mon/PGStatService.h b/src/mon/PGStatService.h index 9dea3573617..ee1b9856775 100644 --- a/src/mon/PGStatService.h +++ b/src/mon/PGStatService.h @@ -64,7 +64,8 @@ public: * creating_pgs (scan_epoch), insert them into the passed pending_creates. */ virtual unsigned maybe_add_creating_pgs(epoch_t scan_epoch, - creating_pgs_t *pending_creates) const { + const mempool::osdmap::map& pools, + creating_pgs_t *pending_creates) const { ceph_abort(); return 0; }