mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 06:31:58 +02:00
bcachefs: Don't error out when logging fsck error
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
cfba90aba9
commit
052210c3fa
|
|
@ -676,6 +676,10 @@ static int __need_discard_or_freespace_err(struct btree_trans *trans,
|
|||
set ? "" : "un",
|
||||
bch2_btree_id_str(btree),
|
||||
buf.buf);
|
||||
if (ret == -BCH_ERR_fsck_ignore ||
|
||||
ret == -BCH_ERR_fsck_errors_not_fixed)
|
||||
ret = 0;
|
||||
|
||||
printbuf_exit(&buf);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1901,10 +1905,8 @@ static int bch2_do_discards_fast_one(struct btree_trans *trans,
|
|||
if (log_fsck_err_on(discard_k.k->type != KEY_TYPE_set,
|
||||
trans, discarding_bucket_not_in_need_discard_btree,
|
||||
"attempting to discard bucket %u:%llu not in need_discard btree",
|
||||
ca->dev_idx, bucket)) {
|
||||
/* log it in the superblock and continue: */
|
||||
ca->dev_idx, bucket))
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = bch2_discard_one_bucket(trans, ca, &need_discard_iter, discard_pos_done, s, true);
|
||||
out:
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ int __bch2_fsck_err(struct bch_fs *c,
|
|||
{
|
||||
struct fsck_err_state *s = NULL;
|
||||
va_list args;
|
||||
bool print = true, suppressing = false, inconsistent = false;
|
||||
bool print = true, suppressing = false, inconsistent = false, exiting = false;
|
||||
struct printbuf buf = PRINTBUF, *out = &buf;
|
||||
int ret = -BCH_ERR_fsck_ignore;
|
||||
const char *action_orig = "fix?", *action = action_orig;
|
||||
|
|
@ -320,13 +320,19 @@ int __bch2_fsck_err(struct bch_fs *c,
|
|||
prt_printf(out, bch2_log_msg(c, ""));
|
||||
#endif
|
||||
|
||||
if ((flags & FSCK_CAN_FIX) &&
|
||||
(flags & FSCK_AUTOFIX) &&
|
||||
if ((flags & FSCK_AUTOFIX) &&
|
||||
(c->opts.errors == BCH_ON_ERROR_continue ||
|
||||
c->opts.errors == BCH_ON_ERROR_fix_safe)) {
|
||||
prt_str(out, ", ");
|
||||
prt_actioning(out, action);
|
||||
ret = -BCH_ERR_fsck_fix;
|
||||
if (flags & FSCK_CAN_FIX) {
|
||||
prt_actioning(out, action);
|
||||
ret = -BCH_ERR_fsck_fix;
|
||||
} else {
|
||||
prt_str(out, ", continuing");
|
||||
ret = -BCH_ERR_fsck_ignore;
|
||||
}
|
||||
|
||||
goto print;
|
||||
} else if (!test_bit(BCH_FS_fsck_running, &c->flags)) {
|
||||
if (c->opts.errors != BCH_ON_ERROR_continue ||
|
||||
!(flags & (FSCK_CAN_FIX|FSCK_CAN_IGNORE))) {
|
||||
|
|
@ -396,14 +402,13 @@ int __bch2_fsck_err(struct bch_fs *c,
|
|||
!(flags & FSCK_CAN_IGNORE)))
|
||||
ret = -BCH_ERR_fsck_errors_not_fixed;
|
||||
|
||||
bool exiting =
|
||||
test_bit(BCH_FS_fsck_running, &c->flags) &&
|
||||
(ret != -BCH_ERR_fsck_fix &&
|
||||
ret != -BCH_ERR_fsck_ignore);
|
||||
|
||||
if (exiting)
|
||||
if (test_bit(BCH_FS_fsck_running, &c->flags) &&
|
||||
(ret != -BCH_ERR_fsck_fix &&
|
||||
ret != -BCH_ERR_fsck_ignore)) {
|
||||
exiting = true;
|
||||
print = true;
|
||||
|
||||
}
|
||||
print:
|
||||
if (print) {
|
||||
if (bch2_fs_stdio_redirect(c))
|
||||
bch2_print(c, "%s\n", out->buf);
|
||||
|
|
|
|||
|
|
@ -45,12 +45,11 @@ int bch2_topology_error(struct bch_fs *);
|
|||
bch2_inconsistent_error(c); \
|
||||
})
|
||||
|
||||
#define bch2_fs_inconsistent_on(cond, c, ...) \
|
||||
#define bch2_fs_inconsistent_on(cond, ...) \
|
||||
({ \
|
||||
bool _ret = unlikely(!!(cond)); \
|
||||
\
|
||||
if (_ret) \
|
||||
bch2_fs_inconsistent(c, __VA_ARGS__); \
|
||||
bch2_fs_inconsistent(__VA_ARGS__); \
|
||||
_ret; \
|
||||
})
|
||||
|
||||
|
|
@ -146,8 +145,13 @@ void bch2_flush_fsck_errs(struct bch_fs *);
|
|||
#define log_fsck_err(c, _err_type, ...) \
|
||||
__fsck_err(c, FSCK_CAN_IGNORE, _err_type, __VA_ARGS__)
|
||||
|
||||
#define log_fsck_err_on(cond, c, _err_type, ...) \
|
||||
__fsck_err_on(cond, c, FSCK_CAN_IGNORE, _err_type, __VA_ARGS__)
|
||||
#define log_fsck_err_on(cond, ...) \
|
||||
({ \
|
||||
bool _ret = unlikely(!!(cond)); \
|
||||
if (_ret) \
|
||||
log_fsck_err(__VA_ARGS__); \
|
||||
_ret; \
|
||||
})
|
||||
|
||||
enum bch_validate_flags;
|
||||
__printf(5, 6)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user