From: Sage Weil Date: Thu, 20 Dec 2018 16:03:10 +0000 (-0600) Subject: osd/OSDMap: disallow new upmaps on pgs that are pending merge X-Git-Tag: v14.1.0~533^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25652%2Fhead;p=ceph.git osd/OSDMap: disallow new upmaps on pgs that are pending merge It's critical that we keep the source and target PGs mapped to the same place. Prevent new pg_upmaps on merge source or target PGs. Signed-off-by: Sage Weil --- diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 676638fdfbc4..30edcfebd1c1 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -1755,8 +1755,16 @@ void OSDMap::maybe_remove_pg_upmaps(CephContext *cct, to_check.insert(p.first); } for (auto& pg : to_check) { - if (!nextmap.pg_exists(pg)) { - ldout(cct, 0) << __func__ << " pg " << pg << " is gone" << dendl; + const pg_pool_t *pi = nextmap.get_pg_pool(pg.pool()); + if (!pi || pg.ps() >= pi->get_pg_num_pending()) { + ldout(cct, 0) << __func__ << " pg " << pg << " is gone or merge source" + << dendl; + to_cancel.insert(pg); + continue; + } + if (pi->is_pending_merge(pg, nullptr)) { + ldout(cct, 0) << __func__ << " pg " << pg << " is pending merge" + << dendl; to_cancel.insert(pg); continue; }