From cffcbc73aaaa874829d5fc9091af3042b887f9a7 Mon Sep 17 00:00:00 2001 From: Paul Emmerich Date: Thu, 26 Jul 2018 21:24:38 +0200 Subject: [PATCH] os/bluestore: handle spurious read errors Some kernels (4.9+) sometime fail to return data when reading from a block device under memory pressure. This patch retries the read if the checksum verification fails, tests show that the first retried read succeeds in ~99.5% of the cases, so 3 attempts are made by default before giving up on the data. Works-around: http://tracker.ceph.com/issues/22464 Signed-off-by: Paul Emmerich --- src/common/legacy_config_opts.h | 2 + src/common/options.cc | 12 ++++++ src/os/bluestore/BlueStore.cc | 35 +++++++++++++++-- src/os/bluestore/BlueStore.h | 4 +- src/test/objectstore/store_test.cc | 63 ++++++++++++++++++++++++++++++ 5 files changed, 112 insertions(+), 4 deletions(-) diff --git a/src/common/legacy_config_opts.h b/src/common/legacy_config_opts.h index 4da595dc3e946..0d0ffac66d9f6 100644 --- a/src/common/legacy_config_opts.h +++ b/src/common/legacy_config_opts.h @@ -975,6 +975,7 @@ OPTION(bluestore_block_wal_size, OPT_U64) // rocksdb wal OPTION(bluestore_block_wal_create, OPT_BOOL) OPTION(bluestore_block_preallocate_file, OPT_BOOL) //whether preallocate space if block/db_path/wal_path is file rather that block device. OPTION(bluestore_csum_type, OPT_STR) // none|xxhash32|xxhash64|crc32c|crc32c_16|crc32c_8 +OPTION(bluestore_retry_disk_reads, OPT_U64) OPTION(bluestore_min_alloc_size, OPT_U32) OPTION(bluestore_min_alloc_size_hdd, OPT_U32) OPTION(bluestore_min_alloc_size_ssd, OPT_U32) @@ -1069,6 +1070,7 @@ OPTION(bluestore_debug_permit_any_bdev_label, OPT_BOOL) OPTION(bluestore_shard_finishers, OPT_BOOL) OPTION(bluestore_debug_random_read_err, OPT_DOUBLE) OPTION(bluestore_debug_inject_bug21040, OPT_BOOL) +OPTION(bluestore_debug_inject_csum_err_probability, OPT_FLOAT) OPTION(kstore_max_ops, OPT_U64) OPTION(kstore_max_bytes, OPT_U64) diff --git a/src/common/options.cc b/src/common/options.cc index 7973c63719ea5..db343a94ebb05 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -3965,6 +3965,13 @@ std::vector