]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: tidy up class_map too on crush removal
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 1 Jul 2017 10:47:42 +0000 (18:47 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 10 Jul 2017 00:45:36 +0000 (08:45 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/crush/CrushWrapper.cc
src/crush/CrushWrapper.h

index 15ce05139bc7b7d9449d5c5ae4550c8b49494c7f..ff90bad94da8f498f00ae36e463301dde6ad1b2c 100644 (file)
@@ -335,11 +335,13 @@ bool CrushWrapper::_maybe_remove_last_instance(CephContext *cct, int item, bool
     crush_remove_bucket(crush, t);
     if (class_bucket.count(item) != 0)
       class_bucket.erase(item);
+    class_remove_item(item);
   }
   if ((item >= 0 || !unlink_only) && name_map.count(item)) {
     ldout(cct, 5) << "_maybe_remove_last_instance removing name for item " << item << dendl;
     name_map.erase(item);
     have_rmaps = false;
+    class_remove_item(item);
   }
   return true;
 }
index e4aae0c87050f3433da8ce1062b7a1750b36d068..ba676840bf43b5702978fdedee0c8cfc6800fe72 100644 (file)
@@ -525,6 +525,13 @@ public:
       }
     }
   }
+  void class_remove_item(int i) {
+    auto it = class_map.find(i);
+    if (it == class_map.end()) {
+      return;
+    }
+    class_map.erase(it);
+  }
   int can_rename_item(const string& srcname,
                      const string& dstname,
                      ostream *ss) const;