@@ -36,7 +36,8 @@ xfs_scrub_excessive_errors(
bool ret;
pthread_mutex_lock(&ctx->lock);
- ret = ctx->max_errors > 0 && ctx->errors_found >= ctx->max_errors;
+ ret = ctx->max_errors > 0 &&
+ (ctx->unfixable_errors + ctx->errors_found) >= ctx->max_errors;
pthread_mutex_unlock(&ctx->lock);
return ret;
@@ -47,6 +48,10 @@ static struct {
int loglevel;
} err_levels[] = {
[S_ERROR] = { .string = "Error", .loglevel = LOG_ERR },
+ [S_UNFIXABLE] = {
+ .string = "Unfixable error",
+ .loglevel = LOG_ERR
+ },
[S_WARN] = { .string = "Warning", .loglevel = LOG_WARNING },
[S_REPAIR] = { .string = "Repaired", .loglevel = LOG_WARNING },
[S_INFO] = { .string = "Info", .loglevel = LOG_INFO },
@@ -108,6 +113,8 @@ __str_out(
out_record:
if (error) /* A syscall failed */
ctx->runtime_errors++;
+ else if (level == S_UNFIXABLE)
+ ctx->unfixable_errors++;
else if (level == S_ERROR)
ctx->errors_found++;
else if (level == S_WARN)
@@ -17,6 +17,7 @@ bool xfs_scrub_excessive_errors(struct scrub_ctx *ctx);
enum error_level {
S_ERROR = 0,
+ S_UNFIXABLE,
S_WARN,
S_REPAIR,
S_INFO,
@@ -40,6 +41,8 @@ void __str_out(struct scrub_ctx *ctx, const char *descr, enum error_level level,
__str_out(ctx, str, S_REPAIR, 0, __FILE__, __LINE__, __VA_ARGS__)
#define record_preen(ctx, str, ...) \
__str_out(ctx, str, S_PREEN, 0, __FILE__, __LINE__, __VA_ARGS__)
+#define str_unfixable_error(ctx, str, ...) \
+ __str_out(ctx, str, S_UNFIXABLE, 0, __FILE__, __LINE__, __VA_ARGS__)
#define dbg_printf(fmt, ...) \
do {if (debug > 1) {printf(fmt, __VA_ARGS__);}} while (0)
@@ -99,7 +99,8 @@ xfs_process_action_items(
workqueue_destroy(&wq);
pthread_mutex_lock(&ctx->lock);
- if (moveon && ctx->errors_found == 0 && want_fstrim) {
+ if (moveon && ctx->errors_found == 0 && ctx->unfixable_errors == 0 &&
+ want_fstrim) {
fstrim(ctx);
progress_add(1);
}
@@ -336,7 +336,7 @@ xfs_scan_connections(
bool moveon = true;
bool ret;
- if (ctx->errors_found) {
+ if (ctx->errors_found || ctx->unfixable_errors) {
str_info(ctx, ctx->mntpoint,
_("Filesystem has errors, skipping connectivity checks."));
return true;
@@ -140,7 +140,7 @@ report_badfile(
bad_length = min(start + length,
br->bmap->bm_physical + br->bmap->bm_length) - start;
- str_error(br->ctx, br->descr,
+ str_unfixable_error(br->ctx, br->descr,
_("media error at data offset %llu length %llu."),
br->bmap->bm_offset + bad_offset, bad_length);
return 0;
@@ -515,12 +515,16 @@ report_outcome(
total_errors = ctx->errors_found + ctx->runtime_errors;
- if (total_errors == 0 && ctx->warnings_found == 0) {
+ if (total_errors == 0 &&
+ ctx->unfixable_errors == 0 &&
+ ctx->warnings_found == 0) {
log_info(ctx, _("No errors found."));
return;
}
- if (total_errors == 0) {
+ if (total_errors == 0 && ctx->warnings_found == 0) {
+ /* nothing to report */
+ } else if (total_errors == 0) {
fprintf(stderr, _("%s: warnings found: %llu\n"), ctx->mntpoint,
ctx->warnings_found);
log_warn(ctx, _("warnings found: %llu"), ctx->warnings_found);
@@ -536,6 +540,13 @@ report_outcome(
total_errors, ctx->warnings_found);
}
+ if (ctx->unfixable_errors) {
+ fprintf(stderr, _("%s: unfixable errors found: %llu\n"),
+ ctx->mntpoint, ctx->unfixable_errors);
+ log_err(ctx, _("unfixable errors found: %llu"),
+ ctx->unfixable_errors);
+ }
+
/*
* Don't advise the user to run repair unless we were successful in
* setting up the scrub and we actually saw corruptions. Warnings
@@ -74,6 +74,7 @@ struct scrub_ctx {
unsigned long long max_errors;
unsigned long long runtime_errors;
unsigned long long errors_found;
+ unsigned long long unfixable_errors;
unsigned long long warnings_found;
unsigned long long inodes_checked;
unsigned long long bytes_checked;