From: David Zafman Date: Wed, 24 May 2017 23:08:34 +0000 (-0700) Subject: osd debug: Add testing support for random read EIO errors X-Git-Tag: ses5-milestone8~1^2~19^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=83457ab69c53abe17e472f498865828a73833606;p=ceph.git osd debug: Add testing support for random read EIO errors filestore_debug_random_read_err Specify % of EIO all filestore reads Signed-off-by: David Zafman --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 443ef8c1a871..9d3a418fa330 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -1178,6 +1178,7 @@ OPTION(bluestore_debug_fsck_abort, OPT_BOOL, false) OPTION(bluestore_debug_omit_kv_commit, OPT_BOOL, false) OPTION(bluestore_debug_permit_any_bdev_label, OPT_BOOL, false) OPTION(bluestore_shard_finishers, OPT_BOOL, false) +OPTION(bluestore_debug_random_read_err, OPT_DOUBLE, 0) OPTION(kstore_max_ops, OPT_U64, 512) OPTION(kstore_max_bytes, OPT_U64, 64*1024*1024) @@ -1221,6 +1222,7 @@ OPTION(filestore_index_retry_probability, OPT_DOUBLE, 0) // Allow object read error injection OPTION(filestore_debug_inject_read_err, OPT_BOOL, false) +OPTION(filestore_debug_random_read_err, OPT_DOUBLE, 0) OPTION(filestore_debug_omap_check, OPT_BOOL, false) // Expensive debugging check on sync OPTION(filestore_omap_header_cache_size, OPT_INT, 1024) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 8861636327c9..60998e8482d5 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -6201,6 +6201,10 @@ int BlueStore::read( if (r == 0 && _debug_data_eio(oid)) { r = -EIO; derr << __func__ << " " << c->cid << " " << oid << " INJECT EIO" << dendl; + } else if (cct->_conf->bluestore_debug_random_read_err && + (rand() % (int)(cct->_conf->bluestore_debug_random_read_err * 100.0)) == 0) { + dout(0) << __func__ << ": inject random EIO" << dendl; + r = -EIO; } dout(10) << __func__ << " " << cid << " " << oid << " 0x" << std::hex << offset << "~" << length << std::dec diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index d2f3053195f2..7120428bc0c8 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -3249,6 +3249,10 @@ int FileStore::read( if (cct->_conf->filestore_debug_inject_read_err && debug_data_eio(oid)) { return -EIO; + } else if (cct->_conf->filestore_debug_random_read_err && + (rand() % (int)(cct->_conf->filestore_debug_random_read_err * 100.0)) == 0) { + dout(0) << __func__ << ": inject random EIO" << dendl; + return -EIO; } else { tracepoint(objectstore, read_exit, got); return got;