From 108ee77b54a17cb6d25730bd764691a21931a920 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 24 Aug 2016 12:45:39 -0400 Subject: [PATCH] os/bluestore: fsck on mkfs (on by default) Signed-off-by: Sage Weil --- src/common/config_opts.h | 1 + src/os/bluestore/BlueStore.cc | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 7a6d35e420181..a87f42ed5d69b 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ddbf5aa0f9be0..fc7374d48d60d 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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; } -- 2.39.5