History log of /linux-master/fs/bcachefs/error.c
Revision Date Author Comments
# b3c7fd35 30-Mar-2024 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: On emergency shutdown, print out current journal sequence number

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# d2554263 23-Mar-2024 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Split out recovery_passes.c

We've grown a fair amount of code for managing recovery passes; tracking
which ones we're running, which ones need to be run, and flagging in the
superblock which ones need to be run on the next recovery.

So it's worth splitting out into its own file, this code is pretty
different from the code in recovery.c.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 52946d82 06-Feb-2024 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Kill more -EIO error codes

This converts -EIOs related to btree node errors to private error codes,
which will help with some ongoing debugging by giving us better error
messages.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# a64a3733 03-Jan-2024 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Don't autofix errors we can't fix

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# d55ddf6e 31-Dec-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Online fsck can now fix errors

BCH_FS_fsck_done -> BCH_FS_fsck_running; set when we might be fixing
fsck errors. Also; set fix_errors to ask by default when fsck is
running.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 96f37eab 31-Dec-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: factor out thread_with_file, thread_with_stdio

thread_with_stdio now knows how to handle input - fsck can now prompt to
fix errors.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 3c471b65 26-Nov-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: convert bch_fs_flags to x-macro

Now we can print out filesystem flags in sysfs, useful for debugging
various "what's my filesystem doing" issues.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 8b16413c 29-Dec-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: bch_sb.recovery_passes_required

Add two new superblock fields. Since the main section of the superblock
is now fully, we have to add a new variable length section for them -
bch_sb_field_ext.

- recovery_passes_requried: recovery passes that must be run on the
next mount
- errors_silent: errors that will be silently fixed

These are to improve upgrading and dwongrading: these fields won't be
cleared until after recovery successfully completes, so there won't be
any issues with crashing partway through an upgrade or a downgrade.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# b65db750 24-Oct-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Enumerate fsck errors

This patch adds a superblock error counter for every distinct fsck
error; this means that when analyzing filesystems out in the wild we'll
be able to see what sorts of inconsistencies are being found and repair,
and hence what bugs to look for.

Errors validating bkeys are not yet considered distinct fsck errors, but
this patch adds a new helper, bkey_fsck_err(), in order to add distinct
error types for them as well.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# f5d26fa3 25-Oct-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: bch_sb_field_errors

Add a new superblock section to keep counts of errors seen since
filesystem creation: we'll be addingcounters for every distinct fsck
error.

The new superblock section has entries of the for [ id, count,
time_of_last_error ]; this is intended to let us see what errors are
occuring - and getting fixed - via show-super output.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 94119eeb 25-Oct-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Add IO error counts to bch_member

We now track IO errors per device since filesystem creation.

IO error counts can be viewed in sysfs, or with the 'bcachefs
show-super' command.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 1809b8cb 10-Sep-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Break up io.c

More reorganization, this splits up io.c into
- io_read.c
- io_misc.c - fallocate, fpunch, truncate
- io_write.c

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 922bc5a0 16-Jul-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Make topology repair a normal recovery pass

This adds bch2_run_explicit_recovery_pass(), for rewinding recovery and
explicitly running a specific recovery pass - this is a more general
replacement for how we were running topology repair before.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# a0f8faea 11-Jul-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: fix_errors option is now a proper enum

Before, it was parsed as a bool but internally it was really an enum:
this lets us pass in all the possible values.

But we special case the option parsing: no supplied value is parsed as
FSCK_FIX_yes, to match the previous behaviour.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 4f2c166e 04-Jun-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Fix bch2_fsck_ask_yn()

- getline() output includes a newline, without stripping that we were
just looping

- Make the prompt clearer

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# c8d5b714 25-Apr-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Make sure hash info gets initialized in fsck

We had some bugs with setting/using first_this_inode in the inode
walker in the dirents/xattr code.

This patch changes to not clear first_this_inode until after
initializing the new hash info.

Also, we fix an error message to not print on transaction restart, and
add a comment to related fsck error code.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 853b7393 15-Apr-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Allow answering y or n to all fsck errors of given type

This changes the ask_yn() function used by fsck to accept Y or N,
meaning yes or no for all errors of a given type.

With this, the user can be prompted only for distinct error types -
useful when a filesystem has lots of errors.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 9c5d38bb 16-Feb-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Don't print out duplicate fsck errors

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 2e984040 01-Feb-2023 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Improve btree node read error path

This ensures that failure to read a btree node error is treated as a
topology error, and returns the correct error so that the topology
repair pass will be run.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# b2d1d56b 13-Nov-2022 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Fixes for building in userspace

- Marking a non-static function as inline doesn't actually work and is
now causing problems - drop that

- Introduce BCACHEFS_LOG_PREFIX for when we want to prefix log messages
with bcachefs (filesystem name)

- Userspace doesn't have real percpu variables (maybe we can get this
fixed someday), put an #ifdef around bch2_disk_reservation_add()
fastpath

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 22f51621 08-Oct-2022 Kent Overstreet <kent.overstreet@linux.dev>

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>


# dbb9936b 25-Sep-2022 Kent Overstreet <kent.overstreet@linux.dev>

bcachefs: Improve bch2_fsck_err()

- factor out fsck_err_get()
- if the "bcachefs (%s):" prefix has already been applied, don't
duplicate it
- convert to printbufs instead of static char arrays
- tidy up control flow a bit
- use bch2_print_string_as_lines(), to avoid messages getting truncated

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 1ed0a5d2 19-Jul-2022 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: Convert fsck errors to errcode.h

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>


# b74b147d 11-Jan-2022 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: Log message improvements

Change the error messages in bch2_inconsistent_error() and
bch2_fatal_error() so we can distinguish them.

Also, prefer bch2_fs_fatal_error() (which also logs an error message) to
bch2_fatal_error(), and change a call to bch2_inconsistent_error() to
bch2_fatal_error() when we can't continue.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>


# 08061519 21-Jun-2021 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: Don't ratelimit certain fsck errors

It's unhelpful if we see "Halting mark and sweep to start topology
repair" but we don't see the error that triggered it.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>


# aae15aaf 24-Apr-2021 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: New and improved topology repair code

This splits out btree topology repair into a separate pass, and makes
some improvements:
- When we have to pick which of two overlapping nodes to drop keys
from, we use the btree node header sequence number to preserve the
newer node

- the gc code has been changed so that it doesn't bail out if we're
continuing/ignoring on fsck error - this way the dump tool can skip
running the repair pass but still walk all reachable metadata

- add a new superblock flag indicating when a filesystem is known to
have btree topology issues, and the topology repair pass should be
run

- changing the start/end of a node might mean keys in that node have to
be deleted: this patch handles that better by splitting it out into a
separate function and running it explicitly in the topology repair
code, previously those keys were only being dropped when the btree
node was read in.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 2436cb9f 20-Feb-2021 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: Use x-macros for more enums

This patch standardizes all the enums that have associated string tables
(probably more enums should have string tables).

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 1ada1606 15-Jun-2020 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: Turn c->state_lock into an rwsem

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# beb6db68 28-May-2020 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: fsck_error_lock requires GFP_NOFS

this fixes a lockdep splat

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# e2ee3eaa 06-Nov-2019 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: Add an option for fsck error ratelimiting

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 89b05118 06-Sep-2019 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: Flush fsck errors when looping in btree gc

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 0bc166ff 28-Mar-2019 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: Track whether filesystem has errors in superblock

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 6543f562 28-Mar-2019 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: Handle fsck errors at runtime better

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 88c07f73 14-Jul-2018 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: Only check inode i_nlink during full fsck

Now that all filesystem operatinos that manipulate the filesystem
heirachy and i_nlink are fully atomic, we can add a feature bit to
indicate i_nlink doesn't need to be checked.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>


# 1c6fdbd8 17-Mar-2017 Kent Overstreet <kent.overstreet@gmail.com>

bcachefs: Initial commit

Initially forked from drivers/md/bcache, bcachefs is a new copy-on-write
filesystem with every feature you could possibly want.

Website: https://bcachefs.org

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>