cksum: parameterize error reactions

This commit is contained in:
Thomas Schoebel-Theuer 2016-12-28 23:41:40 +01:00
parent 100c17564e
commit 94c5c58906
3 changed files with 28 additions and 5 deletions

View File

@ -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);
}
}
}
}

View File

@ -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;

View File

@ -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);
}