From 3396a969741f74e5b1f55d8d7af258493ca26478 Mon Sep 17 00:00:00 2001 From: John Spray Date: Thu, 30 Jul 2015 14:20:56 +0100 Subject: [PATCH] osd/OSDMap: handle incrementals that modify+del pool Because new_pools was processed after old_pools, if something was modified and then deleted in the same incremental map, then the resulting state would be a pool in the map that had no entry in pool_name. Fixes: #12429 Signed-off-by: John Spray (cherry picked from commit 8d4932e721e32a33c1bada54e11d4ecccd868618) --- src/osd/OSDMap.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 1700f6b6e6f2f1..a9154d48a297a8 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -1283,13 +1283,6 @@ int OSDMap::apply_incremental(const Incremental &inc) if (inc.new_pool_max != -1) pool_max = inc.new_pool_max; - for (set::const_iterator p = inc.old_pools.begin(); - p != inc.old_pools.end(); - ++p) { - pools.erase(*p); - name_pool.erase(pool_name[*p]); - pool_name.erase(*p); - } for (map::const_iterator p = inc.new_pools.begin(); p != inc.new_pools.end(); ++p) { @@ -1304,6 +1297,13 @@ int OSDMap::apply_incremental(const Incremental &inc) pool_name[p->first] = p->second; name_pool[p->second] = p->first; } + for (set::const_iterator p = inc.old_pools.begin(); + p != inc.old_pools.end(); + ++p) { + pools.erase(*p); + name_pool.erase(pool_name[*p]); + pool_name.erase(*p); + } for (map::const_iterator i = inc.new_weight.begin(); i != inc.new_weight.end();