From 5d2d839dd92869ce53c00071009ae6ea3653adb6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 13 Dec 2014 21:16:24 -0800 Subject: [PATCH] osd: add copyfrom error injection Unfortunately it's nontrivial to inject this from the usual ceph_test_rados_api_* tests which need to run despite thrashing. Signed-off-by: Sage Weil --- src/common/config_opts.h | 1 + src/osd/ReplicatedPG.cc | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 8313d001419..0808dd14091 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -600,6 +600,7 @@ OPTION(osd_debug_verify_snaps_on_info, OPT_BOOL, false) OPTION(osd_debug_verify_stray_on_activate, OPT_BOOL, false) OPTION(osd_debug_skip_full_check_in_backfill_reservation, OPT_BOOL, false) OPTION(osd_debug_reject_backfill_probability, OPT_DOUBLE, 0) +OPTION(osd_debug_inject_copyfrom_error, OPT_BOOL, false) // inject failure during copyfrom completion OPTION(osd_enable_op_tracker, OPT_BOOL, true) // enable/disable OSD op tracking OPTION(osd_num_op_tracker_shard, OPT_U32, 32) // The number of shards for holding the ops OPTION(osd_op_history_size, OPT_U32, 20) // Max number of completed ops to track diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 5d5b98f452a..ca795d10507 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -6202,6 +6202,11 @@ void ReplicatedPG::process_copy_chunk(hobject_t oid, ceph_tid_t tid, int r) r = -EIO; goto out; } + if (g_conf->osd_debug_inject_copyfrom_error) { + derr << __func__ << " injecting copyfrom failure" << dendl; + r = -EIO; + goto out; + } dout(20) << __func__ << " success; committing" << dendl;