From: Samuel Just Date: Fri, 15 Mar 2013 01:52:02 +0000 (-0700) Subject: OSD: expand_pg_num after pg removes X-Git-Tag: v0.59~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f1b031b3cf195cf6df3d3c47c7d606fba63ed4c4;p=ceph.git OSD: expand_pg_num after pg removes Otherwise: 1) expand_pg_num removes a splitting pg entry 2) peering thread grabs pg lock and starts split 3) OSD::consume_map grabs pg lock and starts removal At step 2), we run afoul of the assert(is_splitting) check in split_pgs. This way, the would be splitting pg is marked as removed prior to the splitting state being updated. Backport: bobtail Fixes: #4449 Signed-off-by: Samuel Just Reviewed-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 3554ffb993d..daedaf28e1e 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -205,8 +205,12 @@ void OSDService::expand_pg_num(OSDMapRef old_map, if (!new_map->have_pg_pool(i->pool())) { in_progress_splits.erase(i++); } else { - i->is_split(old_map->get_pg_num(i->pool()), - new_map->get_pg_num(i->pool()), &children); + if (i->ps() < static_cast(old_map->get_pg_num(i->pool()))) { + i->is_split(old_map->get_pg_num(i->pool()), + new_map->get_pg_num(i->pool()), &children); + } else { + assert(i->ps() < static_cast(new_map->get_pg_num(i->pool()))); + } ++i; } } @@ -4247,9 +4251,6 @@ void OSD::consume_map() int num_pg_primary = 0, num_pg_replica = 0, num_pg_stray = 0; list to_remove; - service.expand_pg_num(service.get_osdmap(), - osdmap); - // scan pg's for (hash_map::iterator it = pg_map.begin(); it != pg_map.end(); @@ -4288,6 +4289,8 @@ void OSD::consume_map() } to_remove.clear(); + service.expand_pg_num(service.get_osdmap(), osdmap); + service.pre_publish_map(osdmap); service.publish_map(osdmap);