This is used by the teuthology repair_test.py.
Signed-off-by: Sage Weil <sage@redhat.com>
OPTION(bluestore_debug_freelist, OPT_BOOL, false)
OPTION(bluestore_debug_prefill, OPT_FLOAT, 0)
OPTION(bluestore_debug_prefragment_max, OPT_INT, 1048576)
+OPTION(bluestore_debug_inject_read_err, OPT_BOOL, false)
OPTION(bluestore_inject_wal_apply_delay, OPT_FLOAT, 0)
OPTION(bluestore_shard_finishers, OPT_BOOL, false)
kv_sync_thread(this),
kv_stop(false),
logger(NULL),
+ debug_read_error_lock("BlueStore::debug_read_error_lock"),
csum_type(bluestore_blob_t::CSUM_CRC32C),
sync_wal_apply(cct->_conf->bluestore_sync_wal_apply)
{
c->cache->trim(
g_conf->bluestore_onode_cache_size,
g_conf->bluestore_buffer_cache_size);
- return 0;
+ int r = 0;
+ if (_debug_mdata_eio(oid)) {
+ r = -EIO;
+ derr << __func__ << " " << c->cid << " " << oid << " INJECT EIO" << dendl;
+ }
+ return r;
}
int BlueStore::read(
c->cache->trim(
g_conf->bluestore_onode_cache_size,
g_conf->bluestore_buffer_cache_size);
+ if (r == 0 && _debug_data_eio(oid)) {
+ r = -EIO;
+ derr << __func__ << " " << c->cid << " " << oid << " INJECT EIO" << dendl;
+ }
dout(10) << __func__ << " " << cid << " " << oid
<< " 0x" << std::hex << offset << "~" << length << std::dec
<< " = " << r << dendl;
c->cache->trim(
g_conf->bluestore_onode_cache_size,
g_conf->bluestore_buffer_cache_size);
+ if (r == 0 && _debug_mdata_eio(oid)) {
+ r = -EIO;
+ derr << __func__ << " " << c->cid << " " << oid << " INJECT EIO" << dendl;
+ }
dout(10) << __func__ << " " << c->cid << " " << oid << " " << name
<< " = " << r << dendl;
return r;
c->cache->trim(
g_conf->bluestore_onode_cache_size,
g_conf->bluestore_buffer_cache_size);
+ if (r == 0 && _debug_mdata_eio(oid)) {
+ r = -EIO;
+ derr << __func__ << " " << c->cid << " " << oid << " INJECT EIO" << dendl;
+ }
dout(10) << __func__ << " " << c->cid << " " << oid
<< " = " << r << dendl;
return r;
txc->t->rmkey(PREFIX_OBJ, s.key);
}
txc->t->rmkey(PREFIX_OBJ, o->key);
+ _debug_obj_on_delete(o->oid);
return 0;
}
std::mutex reap_lock;
list<CollectionRef> removed_collections;
+ RWLock debug_read_error_lock;
+ set<ghobject_t, ghobject_t::BitwiseComparator> debug_data_error_objects;
+ set<ghobject_t, ghobject_t::BitwiseComparator> debug_mdata_error_objects;
+
int csum_type;
uint64_t block_size; ///< block size of block device (power of 2)
TrackedOpRef op = TrackedOpRef(),
ThreadPool::TPHandle *handle = NULL) override;
+ // error injection
+ void inject_data_error(const ghobject_t& o) override {
+ RWLock::WLocker l(debug_read_error_lock);
+ debug_data_error_objects.insert(o);
+ }
+ void inject_mdata_error(const ghobject_t& o) override {
+ RWLock::WLocker l(debug_read_error_lock);
+ debug_mdata_error_objects.insert(o);
+ }
+private:
+ bool _debug_data_eio(const ghobject_t& o) {
+ if (!g_conf->bluestore_debug_inject_read_err) {
+ return false;
+ }
+ RWLock::RLocker l(debug_read_error_lock);
+ return debug_data_error_objects.count(o);
+ }
+ bool _debug_mdata_eio(const ghobject_t& o) {
+ if (!g_conf->bluestore_debug_inject_read_err) {
+ return false;
+ }
+ RWLock::RLocker l(debug_read_error_lock);
+ return debug_mdata_error_objects.count(o);
+ }
+ void _debug_obj_on_delete(const ghobject_t& o) {
+ if (g_conf->bluestore_debug_inject_read_err) {
+ RWLock::WLocker l(debug_read_error_lock);
+ debug_data_error_objects.erase(o);
+ debug_mdata_error_objects.erase(o);
+ }
+ }
+
private:
// --------------------------------------------------------