]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fsck on mkfs (on by default)
authorSage Weil <sage@redhat.com>
Wed, 24 Aug 2016 16:45:39 +0000 (12:45 -0400)
committerSage Weil <sage@redhat.com>
Wed, 24 Aug 2016 17:02:31 +0000 (13:02 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config_opts.h
src/os/bluestore/BlueStore.cc

index 7a6d35e420181ad6754617d694a62ce59f503d79..a87f42ed5d69b90762a76d03809f269f43417877 100644 (file)
@@ -989,6 +989,7 @@ OPTION(bluestore_bitmapallocator_span_size, OPT_INT, 1024) // must be power of 2
 OPTION(bluestore_rocksdb_options, OPT_STR, "compression=kNoCompression,max_write_buffer_number=16,min_write_buffer_number_to_merge=3,recycle_log_file_num=16")
 OPTION(bluestore_fsck_on_mount, OPT_BOOL, false)
 OPTION(bluestore_fsck_on_umount, OPT_BOOL, false)
+OPTION(bluestore_fsck_on_mkfs, OPT_BOOL, true)
 OPTION(bluestore_sync_transaction, OPT_BOOL, false)  // perform kv txn synchronously
 OPTION(bluestore_sync_submit_transaction, OPT_BOOL, false)
 OPTION(bluestore_sync_wal_apply, OPT_BOOL, true)     // perform initial wal work synchronously (possibly in combination with aio so we only *queue* ios)
index ddbf5aa0f9be0459df09c83c9e27e98a1ae057b4..fc7374d48d60db4d7eb323e2c2b3a3476acee057 100644 (file)
@@ -2750,6 +2750,17 @@ int BlueStore::mkfs()
   _close_fsid();
  out_path_fd:
   _close_path();
+
+  if (r == 0 &&
+      g_conf->bluestore_fsck_on_mkfs) {
+    int rc = fsck();
+    if (rc < 0)
+      return rc;
+    if (rc > 0) {
+      derr << __func__ << " fsck found " << rc << " errors" << dendl;
+      r = -EIO;
+    }
+  }
   return r;
 }