diff --git a/kernel/mars_cksum.c b/kernel/mars_cksum.c index 8c411e24..bc1d156a 100644 --- a/kernel/mars_cksum.c +++ b/kernel/mars_cksum.c @@ -163,10 +163,14 @@ void cksum_do_finish(struct cksum_mref_aspect *mref_a, int error) struct mref_object *mref = mref_a->object; atomic_inc(&brick->total_errors); -#if 1 - MARS_ERR("CKSUM MISMATCH status=%d pos=%lld len=%d\n", - status, mref->ref_pos, mref->ref_len); -#endif + if (brick->report_errors) { + MARS_ERR("CKSUM MISMATCH status=%d pos=%lld len=%d\n", + status, mref->ref_pos, mref->ref_len); + } + /* Hard blocking exactly where it is */ + while (brick->block_on_errors) { + brick_msleep(100); + } } } } diff --git a/kernel/mars_cksum.h b/kernel/mars_cksum.h index 5870888b..0a694378 100644 --- a/kernel/mars_cksum.h +++ b/kernel/mars_cksum.h @@ -46,6 +46,10 @@ struct cksum_mref_aspect { struct cksum_brick { MARS_BRICK(cksum); + /* parameters */ + bool report_errors; + bool block_on_errors; + /* statistics */ atomic_t total_reads; atomic_t total_writes; atomic_t total_small_reads; diff --git a/kernel/sy_old/mars_main.c b/kernel/sy_old/mars_main.c index 25625d40..d88faf2a 100644 --- a/kernel/sy_old/mars_main.c +++ b/kernel/sy_old/mars_main.c @@ -341,6 +341,8 @@ const char *rot_keys[] = { "inf-fetch", // from make_sync() "inf-sync", + // from make_bio() + "err-cksum", // from make_log_step() "wrn-log-consecutive", // from make_log_finalize() @@ -4036,8 +4038,21 @@ int make_bio(void *buf, struct mars_dent *dent) cksum_name); MARS_INF("cksum %p\n", brick); - if (brick) + if (brick) { + struct cksum_brick *cksum_brick = (void*)brick; + int err_count; + brick->killme = true; + cksum_brick->report_errors = true; + cksum_brick->block_on_errors = + _check_allow(global, dent->d_parent, "pause-cksum"); + err_count = atomic_read(&cksum_brick->total_errors); + if (err_count > 0) { + make_rot_msg(rot, "err-cksum", + "There are %d CKSUM errors", + err_count); + } + } brick_string_free(bio_name); }