Merge pull request #13307 from songbaisen/s12

osd:  add is_split check before _start_split

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Yuri Weinstein 2017-02-14 09:57:52 -08:00 committed by GitHub
commit 5de6a0a4c1
2 changed files with 6 additions and 4 deletions

View File

@ -358,11 +358,12 @@ void OSDService::_maybe_split_pgid(OSDMapRef old_map,
spg_t pgid)
{
assert(old_map->have_pg_pool(pgid.pool()));
if (pgid.ps() < static_cast<unsigned>(old_map->get_pg_num(pgid.pool()))) {
int old_pgnum = old_map->get_pg_num(pgid.pool());
if (pgid.ps() < static_cast<unsigned>(old_pgnum)) {
set<spg_t> children;
pgid.is_split(old_map->get_pg_num(pgid.pool()),
new_map->get_pg_num(pgid.pool()), &children);
_start_split(pgid, children);
if (pgid.is_split(old_pgnum,
new_map->get_pg_num(pgid.pool()), &children)) {
_start_split(pgid, children); }
} else {
assert(pgid.ps() < static_cast<unsigned>(new_map->get_pg_num(pgid.pool())));
}

View File

@ -610,6 +610,7 @@ public:
int get_pg_num(int pg_pool) const
{
const pg_pool_t *pool = get_pg_pool(pg_pool);
assert(NULL != pool);
return pool->get_pg_num();
}