From 7e0482d0f3b618259bbd5366c4cbdcf324a67216 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 17 Oct 2018 17:12:34 -0500 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 (cherry picked from commit cffcbc73aaaa874829d5fc9091af3042b887f9a7) Conflicts: src/common/legacy_config_opts.h - adjacent options src/common/options.cc - no RUNTIME flag in luminous src/os/bluestore/BlueStore.cc src/os/bluestore/BlueStore.h - adjacent perfcounter src/test/objectstore/store_test.cc - adjacent tests, no #ifdef - g_conf, not g_conf() - no create_new_collection - queue_transaction etc take osr, not ch --- src/common/legacy_config_opts.h | 2 + src/common/options.cc | 10 +++++ src/os/bluestore/BlueStore.cc | 35 ++++++++++++++-- src/os/bluestore/BlueStore.h | 4 +- src/test/objectstore/store_test.cc | 67 ++++++++++++++++++++++++++++++ 5 files changed, 114 insertions(+), 4 deletions(-) diff --git a/src/common/legacy_config_opts.h b/src/common/legacy_config_opts.h index 38b36a60cc88..db3bbe40045d 100644 --- a/src/common/legacy_config_opts.h +++ b/src/common/legacy_config_opts.h @@ -1029,6 +1029,7 @@ OPTION(bluestore_block_preallocate_file, OPT_BOOL) //whether preallocate space i OPTION(bluestore_csum_type, OPT_STR) // none|xxhash32|xxhash64|crc32c|crc32c_16|crc32c_8 OPTION(bluestore_csum_min_block, OPT_U32) OPTION(bluestore_csum_max_block, OPT_U32) +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) @@ -1123,6 +1124,7 @@ OPTION(bluestore_debug_omit_kv_commit, OPT_BOOL) 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_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 1ed027c9bebd..412121b94af7 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -3391,6 +3391,12 @@ std::vector