From: Kefu Chai Date: Wed, 26 Apr 2017 12:17:42 +0000 (+0800) Subject: mon/OSDMonitor: check get()'s return value instead of bl's length X-Git-Tag: v12.0.3~213^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=97a58fa69a05da4b39ea56804f0cd24b5cfb7c40;p=ceph-ci.git mon/OSDMonitor: check get()'s return value instead of bl's length instead of assuming how the bl is encoded, we'd better rely on the return code of get(). Signed-off-by: Kefu Chai --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index e740677f4ad..b1b60331985 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -303,8 +303,7 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap) if (mon->monmap->get_required_features().contains_all( ceph::features::mon::FEATURE_LUMINOUS)) { bufferlist bl; - mon->store->get(OSD_PG_CREATING_PREFIX, "creating", bl); - if (bl.length()) { + if (!mon->store->get(OSD_PG_CREATING_PREFIX, "creating", bl)) { auto p = bl.begin(); std::lock_guard l(creating_pgs_lock); creating_pgs.decode(p);