]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
BlueStore: add a guard for collection loading
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 26 Jan 2016 09:12:25 +0000 (17:12 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 2 Feb 2016 06:04:17 +0000 (14:04 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index 7efe431acf9eba16f4ea630a3489a3262d2fd6d7..086779e53a6970125572821a363e4f3f70109cae 100644 (file)
@@ -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 {