diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-09 00:54:36 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-08-28 21:10:56 -0400 |
commit | 5b39f17c553ffd9fdb4fb23fb25a5c06fed7baa8 (patch) | |
tree | 9b98e156691e1c480c8e15a26931e2f0c675f84d /fs/bcachefs/error.c | |
parent | 5b3d548c1dd25eda2fa9c7c01516c33af3727f69 (diff) |
bcachefs: Ensure fsck error is printed before panic
When errors=panic, we want to make sure we print the error before
calling bch2_inconsistent_error().
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/error.c')
-rw-r--r-- | fs/bcachefs/error.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/bcachefs/error.c b/fs/bcachefs/error.c index 762abdf2f283..2fb5102ee31d 100644 --- a/fs/bcachefs/error.c +++ b/fs/bcachefs/error.c @@ -104,7 +104,7 @@ int bch2_fsck_err(struct bch_fs *c, unsigned flags, const char *fmt, ...) { struct fsck_err_state *s = NULL; va_list args; - bool print = true, suppressing = false; + bool print = true, suppressing = false, inconsistent = false; struct printbuf buf = PRINTBUF, *out = &buf; int ret = -BCH_ERR_fsck_ignore; @@ -136,7 +136,7 @@ int bch2_fsck_err(struct bch_fs *c, unsigned flags, const char *fmt, ...) if (c->opts.errors != BCH_ON_ERROR_continue || !(flags & (FSCK_CAN_FIX|FSCK_CAN_IGNORE))) { prt_str(out, ", shutting down"); - bch2_inconsistent_error(c); + inconsistent = true; ret = -BCH_ERR_fsck_errors_not_fixed; } else if (flags & FSCK_CAN_FIX) { prt_str(out, ", fixing"); @@ -189,6 +189,9 @@ int bch2_fsck_err(struct bch_fs *c, unsigned flags, const char *fmt, ...) printbuf_exit(&buf); + if (inconsistent) + bch2_inconsistent_error(c); + if (ret == -BCH_ERR_fsck_fix) { set_bit(BCH_FS_ERRORS_FIXED, &c->flags); } else { |