diff --git a/cmdline/dry.c b/cmdline/dry.c index b94455e7..03783229 100644 --- a/cmdline/dry.c +++ b/cmdline/dry.c @@ -78,10 +78,11 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit /* if the file is closed or different than the current one */ if (handle[j].file == 0 || handle[j].file != block_file_get(block)) { - /* close the old one, if any */ + struct snapraid_file* file = handle[j].file; ret = handle_close(&handle[j]); if (ret == -1) { /* LCOV_EXCL_START */ + ftag("error:%u:%s:%s: Close error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected close error in a data disk, it isn't possible to dry.\n"); printf("Stopping at block %u\n", i); ++error; @@ -150,9 +151,12 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit bail: /* close all the files left open */ for (j = 0; j < diskmax; ++j) { + struct snapraid_file* file = handle[j].file; + struct snapraid_disk* disk = handle[j].disk; ret = handle_close(&handle[j]); if (ret == -1) { /* LCOV_EXCL_START */ + ftag("error:%u:%s:%s: Close error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected close error in a data disk.\n"); ++error; /* continue, as we are already exiting */ diff --git a/cmdline/scrub.c b/cmdline/scrub.c index f6db1fa9..2844a331 100644 --- a/cmdline/scrub.c +++ b/cmdline/scrub.c @@ -299,7 +299,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par /* LCOV_EXCL_STOP */ } - ferr("Input/Output error in file '%s' at position '%u'\n", handle[j].path, block_file_pos(block)); + flog("Input/Output error in file '%s' at position '%u'\n", handle[j].path, block_file_pos(block)); ++io_error; io_error_on_this_block = 1; continue; @@ -337,7 +337,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par ++error; error_on_this_block = 1; } else { - ferr("Data error in file '%s' at position '%u'\n", handle[j].path, block_file_pos(block)); + flog("Data error in file '%s' at position '%u'\n", handle[j].path, block_file_pos(block)); ++silent_error; silent_error_on_this_block = 1; } @@ -377,7 +377,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par /* LCOV_EXCL_STOP */ } - ferr("Input/Output error in parity '%s' at position '%u'\n", lev_config_name(l), i); + flog("Input/Output error in parity '%s' at position '%u'\n", lev_config_name(l), i); ++io_error; io_error_on_this_block = 1; continue; @@ -506,9 +506,12 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par bail: for (j = 0; j < diskmax; ++j) { + struct snapraid_file* file = handle[j].file; + struct snapraid_disk* disk = handle[j].disk; ret = handle_close(&handle[j]); if (ret == -1) { /* LCOV_EXCL_START */ + ftag("error:%u:%s:%s: Close error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected close error in a data disk.\n"); ++error; /* continue, as we are already exiting */ diff --git a/cmdline/sync.c b/cmdline/sync.c index 709068d3..60f468ca 100644 --- a/cmdline/sync.c +++ b/cmdline/sync.c @@ -320,7 +320,8 @@ end: printf("Everything OK\n"); } - ftag("hash_summary:error_readwrite:%u\n", error); + ftag("hash_summary:error_file:%u\n", error); + ftag("hash_summary:error_io:%u\n", io_error); /* proceed without bailing out */ goto finish; @@ -331,8 +332,11 @@ bail: /* close files left open */ for (j = 0; j < diskmax; ++j) { + struct snapraid_file* file = handle[j].file; + struct snapraid_disk* disk = handle[j].disk; ret = handle_close(&handle[j]); if (ret == -1) { + ftag("error:%u:%s:%s: Close error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected close error in a data disk.\n"); ++error; /* continue, as we are already exiting */ @@ -1151,9 +1155,12 @@ end: bail: for (j = 0; j < diskmax; ++j) { + struct snapraid_file* file = handle[j].file; + struct snapraid_disk* disk = handle[j].disk; ret = handle_close(&handle[j]); if (ret == -1) { /* LCOV_EXCL_START */ + ftag("error:%u:%s:%s: Close error. %s\n", i, disk->name, file->sub, strerror(errno)); ferr("DANGER! Unexpected close error in a data disk.\n"); ++error; /* continue, as we are already exiting */