From: xie xingguo Date: Tue, 26 Jan 2016 09:12:25 +0000 (+0800) Subject: BlueStore: add a guard for collection loading X-Git-Tag: v10.0.4~75^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=10bd8addf6b2e8081ae8f68720489c2fce8c9d06;p=ceph.git BlueStore: add a guard for collection loading Signed-off-by: xie xingguo --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 7efe431acf9e..086779e53a69 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1528,10 +1528,15 @@ int BlueStore::_open_collections(int *errors) coll_t cid; if (cid.parse(it->key())) { CollectionRef c(new Collection(this, cid)); - bufferlist bl; - db->get(PREFIX_COLL, it->key(), &bl); + bufferlist bl = it->value(); bufferlist::iterator p = bl.begin(); - ::decode(c->cnode, p); + try { + ::decode(c->cnode, p); + } catch (buffer::error& e) { + derr << __func__ << " failed to decode cnode, key:" + << pretty_binary_string(it->key()) << dendl; + return -EIO; + } dout(20) << __func__ << " opened " << cid << dendl; coll_map[cid] = c; } else {