From 2445b5e7ebfd42a3a292a86d15aec28c6e494308 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Tue, 2 Feb 2016 17:30:27 +0800 Subject: [PATCH] osdc/objecter: update crush location in a safer way Signed-off-by: xie xingguo --- src/osdc/Objecter.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 8fd5c38a3aeb..cff49d488773 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -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 new_crush_location; vector 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 ------------------------------ -- 2.47.3