From aee56ba2c7926afc7f02136320fe31f53012790b Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Mon, 29 Dec 2014 19:36:01 +0100 Subject: [PATCH] Prints a final warning in case of silent error for sync and scrub. --- cmdline/scrub.c | 12 ++++++------ cmdline/sync.c | 10 +++++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/cmdline/scrub.c b/cmdline/scrub.c index 4b663ac0..f6905e5b 100644 --- a/cmdline/scrub.c +++ b/cmdline/scrub.c @@ -329,9 +329,6 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par error_on_this_block = 1; } else { fprintf(stderr, "Data error in file '%s' at position '%u'\n", handle[j].path, block_file_pos(block)); - fprintf(stderr, "WARNING! Unexpected data error in a data disk! The block is now marked as bad!\n"); - fprintf(stderr, "Try with 'snapraid -e fix' to recover!\n"); - ++silent_error; silent_error_on_this_block = 1; } @@ -394,9 +391,6 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par error_on_this_block = 1; } else { fprintf(stderr, "Data error in parity '%s' at position '%u'\n", lev_config_name(l), i); - fprintf(stderr, "WARNING! Unexpected data error in a parity disk! The block is now marked as bad!\n"); - fprintf(stderr, "Try with 'snapraid -e fix' to recover!\n"); - ++silent_error; silent_error_on_this_block = 1; } @@ -464,6 +458,12 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par state_usage_print(state); + if (silent_error != 0) { + fprintf(stderr, "WARNING! Unexpected data errors! The respective blocks are now marked as bad!\n"); + fprintf(stderr, "Use 'snapraid status' to list the bad blocks.\n"); + fprintf(stderr, "Use 'snapraid -e fix' to recover.\n"); + } + if (error || silent_error || io_error) { printf("\n"); printf("%8u file errors\n", error); diff --git a/cmdline/sync.c b/cmdline/sync.c index 2442e68b..ef1b266b 100644 --- a/cmdline/sync.c +++ b/cmdline/sync.c @@ -756,9 +756,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari continue; } else { /* otherwise it's a BLK with silent error */ fprintf(stdlog, "error:%u:%s:%s: Data error at position %u\n", i, disk->name, file->sub, block_file_pos(block)); - fprintf(stderr, "Data error at file '%s' at position '%u'\n", handle[j].path, block_file_pos(block)); - fprintf(stderr, "WARNING! Unexpected data error in a data disk! The block is now marked as bad!\n"); - fprintf(stderr, "Try with 'snapraid -e fix' to recover!\n"); + fprintf(stderr, "Data error in file '%s' at position '%u'\n", handle[j].path, block_file_pos(block)); /* save the failed block for the fix */ failed[failed_count].index = j; @@ -1072,6 +1070,12 @@ end: state_usage_print(state); + if (silent_error != 0) { + fprintf(stderr, "WARNING! Unexpected data errors! The respective blocks are now marked as bad!\n"); + fprintf(stderr, "Use 'snapraid status' to list the bad blocks.\n"); + fprintf(stderr, "Use 'snapraid -e fix' to recover.\n"); + } + if (error || silent_error || io_error) { printf("\n"); printf("%8u file errors\n", error);