]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/objecter: update crush location in a safer way 7477/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 2 Feb 2016 09:30:27 +0000 (17:30 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 2 Feb 2016 11:48:13 +0000 (19:48 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osdc/Objecter.cc

index 8fd5c38a3aeb9ddeb1d2087753ede0b2e294ae53..cff49d48877313d9e0ea5326e94c0b1d5419c85e 100644 (file)
@@ -179,14 +179,16 @@ void Objecter::handle_conf_change(const struct md_config_t *conf,
 void Objecter::update_crush_location()
 {
   RWLock::WLocker rwlocker(rwlock);
-  crush_location.clear();
+  std::multimap<string,string> new_crush_location;
   vector<string> lvec;
   get_str_vec(cct->_conf->crush_location, ";, \t", lvec);
-  int r = CrushWrapper::parse_loc_multimap(lvec, &crush_location);
+  int r = CrushWrapper::parse_loc_multimap(lvec, &new_crush_location);
   if (r < 0) {
     lderr(cct) << "warning: crush_location '" << cct->_conf->crush_location
-              << "' does not parse" << dendl;
+              << "' does not parse, leave origin crush_location untouched." << dendl;
+    return;
   }
+  crush_location = new_crush_location;
 }
 
 // messages ------------------------------