Synchronizes log entries for errors
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run

This commit is contained in:
Andrea Mazzoleni 2026-09-15 22:48:28 +02:00
parent 215aed17e7
commit 8b9858ffdc
3 changed files with 24 additions and 24 deletions

View file

@ -2266,7 +2266,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
failed[failed_count].handle = &handle[j];
++failed_count;
log_tag("error:%" PRIu64 ":%s:%s: Data error at position %" PRIu64 ", diff hash bits %u/%zu\n", i, disk->name, esc_tag(file->sub), file_pos, diff, BLOCK_HASH_SIZE * 8);
log_tag("error_data:%" PRIu64 ":%s:%s: Data error at position %" PRIu64 ", diff hash bits %u/%zu\n", i, disk->name, esc_tag(file->sub), file_pos, diff, BLOCK_HASH_SIZE * 8);
++silent_error;
continue;
}
@ -2423,7 +2423,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
/* mark that the read parity is wrong, setting ptr to 0 */
buffer_recov[l] = 0;
log_tag("parity_error:%" PRIu64 ":%s: Data error, diff parity bits %u/%u\n", i, lev_config_name(l), diff, state->block_size * 8);
log_tag("parity_error_data:%" PRIu64 ":%s: Data error, diff parity bits %u/%u\n", i, lev_config_name(l), diff, state->block_size * 8);
++silent_error;
}
}
@ -2458,7 +2458,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
ret = parity_write(parity[l], i, buffer[diskmax + l], state->block_size, state->opt.skip_fallocate);
if (ret == -1) {
/* LCOV_EXCL_START */
log_tag("%s:%" PRIu64 ":%s: Write error. %s.\n", es(errno), i, lev_config_name(l), strerror(errno));
log_tag("parity_%s:%" PRIu64 ":%s: Write error. %s.\n", es(errno), i, lev_config_name(l), strerror(errno));
log_fatal_errno(errno, lev_config_name(l));
log_fatal(errno, "Stopping at block %" PRIu64 "\n", i);
@ -2597,7 +2597,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error creating ancestor '%s%s'. %s.\n", disk->dir, file->sub, strerror(errno));
log_tag("empty_%s:%" PRIu64 ":%s:%s: Create ancestor error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("empty_%s:%s:%s: Create ancestor error. %s.\n", es(errno), disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -2614,7 +2614,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (f == -1) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error creating '%s%s'. %s.\n", disk->dir, file->sub, strerror(errno));
log_tag("empty_%s:%" PRIu64 ":%s:%s: Create error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("empty_%s:%s:%s: Create error. %s.\n", es(errno), disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -2628,7 +2628,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error timing '%s%s'. %s.\n", disk->dir, file->sub, strerror(errno));
log_tag("empty_%s:%" PRIu64 ":%s:%s: Time error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("empty_%s:%s:%s: Time error. %s.\n", es(errno), disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -2644,7 +2644,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error closing '%s%s'. %s.\n", disk->dir, file->sub, strerror(errno));
log_tag("empty_%s:%" PRIu64 ":%s:%s: Close error. %s.\n", es(errno), i, disk->name, esc_tag(file->sub), strerror(errno));
log_tag("empty_%s:%s:%s: Close error. %s.\n", es(errno), disk->name, esc_tag(file->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -2787,7 +2787,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error creating ancestor '%s%s'. %s.\n", disk->dir, slink->sub, strerror(errno));
log_tag("%slink_%s:%" PRIu64 ":%s:%s: Create ancestor error. %s.\n", link, es(errno), i, disk->name, esc_tag(slink->sub), strerror(errno));
log_tag("%slink_%s:%s:%s: Create ancestor error. %s.\n", link, es(errno), disk->name, esc_tag(slink->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -2801,7 +2801,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0 && errno != ENOENT) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error removing '%s%s'. %s.\n", disk->dir, slink->sub, strerror(errno));
log_tag("%slink_%s:%" PRIu64 ":%s:%s: Remove error. %s.\n", link, es(errno), i, disk->name, esc_tag(slink->sub), strerror(errno));
log_tag("%slink_%s:%s:%s: Remove error. %s.\n", link, es(errno), disk->name, esc_tag(slink->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -2816,7 +2816,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error writing hardlink '%s' to '%s'. %s.\n", path, pathto, strerror(errno));
log_tag("hardlink_%s:%" PRIu64 ":%s:%s: Hardlink error. %s.\n", es(errno), i, disk->name, esc_tag(slink->sub), strerror(errno));
log_tag("hardlink_%s:%s:%s: Hardlink error. %s.\n", es(errno), disk->name, esc_tag(slink->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -2832,7 +2832,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error writing symlink '%s' to '%s'. %s.\n", path, slink->linkto, strerror(errno));
log_tag("symlink_%s:%" PRIu64 ":%s:%s: Hardlink error. %s.\n", es(errno), i, disk->name, esc_tag(slink->sub), strerror(errno));
log_tag("symlink_%s:%s:%s: Hardlink error. %s.\n", es(errno), disk->name, esc_tag(slink->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -2894,7 +2894,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error creating ancestor '%s%s'. %s.\n", disk->dir, dir->sub, strerror(errno));
log_tag("dir_%s:%" PRIu64 ":%s:%s: Create ancestor error. %s.\n", es(errno), i, disk->name, esc_tag(dir->sub), strerror(errno));
log_tag("dir_%s:%s:%s: Create ancestor error. %s.\n", es(errno), disk->name, esc_tag(dir->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");
@ -2908,7 +2908,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
if (ret != 0 && errno != EEXIST) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error creating directory '%s%s'. %s.\n", disk->dir, dir->sub, strerror(errno));
log_tag("dir_%s:%" PRIu64 ":%s:%s: Create directory error. %s.\n", es(errno), i, disk->name, esc_tag(dir->sub), strerror(errno));
log_tag("dir_%s:%s:%s: Create directory error. %s.\n", es(errno), disk->name, esc_tag(dir->sub), strerror(errno));
log_fatal_errno(errno, disk->name);
log_fatal(errno, "Stopping\n");

View file

@ -457,7 +457,7 @@ void state_pool(struct snapraid_state* state)
else
msg_status("No link\n");
log_tag("summary:link_count::%u\n", count);
log_tag("summary:link_count:%u\n", count);
log_tag("summary:exit:ok\n");
log_flush();
}

View file

@ -1608,7 +1608,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
log_tag("blocksize:%u\n", state->block_size);
for (i = state->disklist; i != 0; i = i->next) {
struct snapraid_disk* disk = i->data;
log_tag("data:%s:%s:%s\n", esc_tag(disk->name), esc_tag(disk->mount_point), disk->uuid);
log_tag("data:%s:%s:%s\n", disk->name, esc_tag(disk->mount_point), disk->uuid);
}
for (i = state->extralist; i != 0; i = i->next) {
struct snapraid_extra* extra = i->data;
@ -1947,8 +1947,8 @@ void state_refresh(struct snapraid_state* state)
disk->total_blocks = map->total_blocks;
disk->free_blocks = map->free_blocks;
log_tag("fsinfo_data_split:%s:%" PRIu64 ":%" PRIu64 ":%s:%s\n", esc_tag(disk->name), disk->total_blocks * bs, disk->free_blocks * bs, disk->fstype, disk->fslabel);
log_tag("fsinfo_data:%s:%" PRIu64 ":%" PRIu64 "\n", esc_tag(disk->name), disk->total_blocks * bs, disk->free_blocks * bs);
log_tag("fsinfo_data_split:%s:%" PRIu64 ":%" PRIu64 ":%s:%s\n", disk->name, disk->total_blocks * bs, disk->free_blocks * bs, disk->fstype, esc_tag(disk->fslabel));
log_tag("fsinfo_data:%s:%" PRIu64 ":%" PRIu64 "\n", disk->name, disk->total_blocks * bs, disk->free_blocks * bs);
}
/* for all parities */
@ -1993,9 +1993,9 @@ void state_refresh(struct snapraid_state* state)
state->parity[l].free_blocks += split_free_blocks;
if (s == 0)
log_tag("fsinfo_parity_split:%s:%" PRIu64 ":%" PRIu64 ":%s:%s\n", lev_config_name(l), split_total_blocks * bs, split_free_blocks * bs, split->fstype, split->fslabel);
log_tag("fsinfo_parity_split:%s:%" PRIu64 ":%" PRIu64 ":%s:%s\n", lev_config_name(l), split_total_blocks * bs, split_free_blocks * bs, split->fstype, esc_tag(split->fslabel));
else
log_tag("fsinfo_parity_split:%s/%u:%" PRIu64 ":%" PRIu64 ":%s:%s\n", lev_config_name(l), s, split_total_blocks * bs, split_free_blocks * bs, split->fstype, split->fslabel);
log_tag("fsinfo_parity_split:%s/%u:%" PRIu64 ":%" PRIu64 ":%s:%s\n", lev_config_name(l), s, split_total_blocks * bs, split_free_blocks * bs, split->fstype, esc_tag(split->fslabel));
}
log_tag("fsinfo_parity:%s:%" PRIu64 ":%" PRIu64 "\n", lev_config_name(l), state->parity[l].total_blocks * bs, state->parity[l].free_blocks * bs);
@ -2923,7 +2923,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* LCOV_EXCL_STOP */
}
log_tag("content_info:dealloc:%s:%" PRIu64 "\n", esc_tag(disk->name), v_count);
log_tag("content_info:dealloc:%s:%" PRIu64 "\n", disk->name, v_count);
for (v_pos = 0; v_pos < v_count; ++v_pos) {
char sub[PATH_MAX];
@ -2988,7 +2988,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* allocate the file */
struct snapraid_dealloc* dealloc = dealloc_alloc(state->block_size, sub, v_size, v_mtime_sec, v_mtime_nsec);
log_tag("content_info:dealloc_entry:%s:%s:%" PRIu64 ":%" PRIu64 ":%u\n", esc_tag(disk->name), esc_tag(dealloc->sub), dealloc->size, dealloc->mtime_sec, dealloc->mtime_nsec);
log_tag("content_info:dealloc_entry:%s:%s:%" PRIu64 ":%" PRIu64 ":%u\n", disk->name, esc_tag(dealloc->sub), dealloc->size, dealloc->mtime_sec, dealloc->mtime_nsec);
/* read all hashes */
for (block_off_t k = 0; k < dealloc->blockmax; ++k) {
@ -4342,7 +4342,7 @@ static void* state_write_thread(void* arg)
sputb64(v_count, f);
if (context->first)
log_tag("content_info:dealloc:%s:%" PRIu64 "\n", esc_tag(disk->name), v_count);
log_tag("content_info:dealloc:%s:%" PRIu64 "\n", disk->name, v_count);
/* for each file */
for (j = tommy_list_head(&disk->dealloclist); j != 0; j = j->next) {
@ -4358,7 +4358,7 @@ static void* state_write_thread(void* arg)
sputb32(dealloc->mtime_nsec + 1, f);
if (context->first)
log_tag("content_info:dealloc_entry:%s:%s:%" PRIu64 ":%" PRIu64 ":%u\n", esc_tag(disk->name), esc_tag(dealloc->sub), dealloc->size, dealloc->mtime_sec, dealloc->mtime_nsec);
log_tag("content_info:dealloc_entry:%s:%s:%" PRIu64 ":%" PRIu64 ":%u\n", disk->name, esc_tag(dealloc->sub), dealloc->size, dealloc->mtime_sec, dealloc->mtime_nsec);
/* deallocated hashes are already contiguous in memory */
swrite(dealloc->blockhash, (size_t)dealloc->blockmax * BLOCK_HASH_SIZE, f);
@ -4372,7 +4372,7 @@ static void* state_write_thread(void* arg)
}
} else {
if (context->first)
log_tag("content_info:dealloc:%s:0\n", esc_tag(disk->name));
log_tag("content_info:dealloc:%s:0\n", disk->name);
}
}