]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: EIO if we can't read some existing super keys
authorSage Weil <sage@redhat.com>
Tue, 31 Jan 2017 16:59:57 +0000 (11:59 -0500)
committerSage Weil <sage@redhat.com>
Tue, 31 Jan 2017 16:59:57 +0000 (11:59 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index 61421eb4683f57057451b3aceb7a806b715500d5..b4e84dce21a2611bfdf1dfa97709089589b54674 100644 (file)
@@ -4108,6 +4108,16 @@ int BlueStore::mkfs()
   if (r < 0)
     goto out_close_db;
 
+  {
+    KeyValueDB::Transaction t = db->get_transaction();
+    {
+      bufferlist bl;
+      ::encode((uint64_t)0, bl);
+      t->set(PREFIX_SUPER, "nid_max", bl);
+      t->set(PREFIX_SUPER, "blobid_max", bl);
+    }
+    db->submit_transaction_sync(t);
+  }
   _save_min_min_alloc_size(min_alloc_size);
 
   r = _open_alloc();
@@ -4158,6 +4168,9 @@ int BlueStore::mkfs()
       r = -EIO;
     }
   }
+  if (r < 0) {
+    derr << __func__ << " failed, " << cpp_strerror(r) << dendl;
+  }
   return r;
 }
 
@@ -6345,6 +6358,8 @@ int BlueStore::_open_super_meta()
       ::decode(v, p);
       nid_max = v;
     } catch (buffer::error& e) {
+      derr << __func__ << " unable to read nid_max" << dendl;
+      return -EIO;
     }
     dout(10) << __func__ << " old nid_max " << nid_max << dendl;
     nid_last = nid_max.load();
@@ -6361,6 +6376,8 @@ int BlueStore::_open_super_meta()
       ::decode(v, p);
       blobid_max = v;
     } catch (buffer::error& e) {
+      derr << __func__ << " unable to read blobid_max" << dendl;
+      return -EIO;
     }
     dout(10) << __func__ << " old blobid_max " << blobid_max << dendl;
     blobid_last = blobid_max.load();
@@ -6405,6 +6422,8 @@ int BlueStore::_open_super_meta()
       ::decode(bluefs_extents, p);
     }
     catch (buffer::error& e) {
+      derr << __func__ << " unable to read bluefs_extents" << dendl;
+      return -EIO;
     }
     dout(10) << __func__ << " bluefs_extents 0x" << std::hex << bluefs_extents
             << std::dec << dendl;