diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-23 19:29:19 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-31 20:36:11 -0400 |
commit | 79032b078173f87a13f8618cdab710798be67314 (patch) | |
tree | ca391624dd45f210f1b0d1811ab9147a8bc60f93 /fs/bcachefs/btree_update_interior.h | |
parent | 40cb26233a060aeb936de7ea1f6ac2659ed9951c (diff) | |
download | linux-stable-79032b078173f87a13f8618cdab710798be67314.tar.gz linux-stable-79032b078173f87a13f8618cdab710798be67314.tar.bz2 linux-stable-79032b078173f87a13f8618cdab710798be67314.zip |
bcachefs: Improved topology repair checks
Consolidate bch2_gc_check_topology() and btree_node_interior_verify(),
and replace them with an improved version,
bch2_btree_node_check_topology().
This checks that children of an interior node correctly span the full
range of the parent node with no overlaps.
Also, ensure that topology repairs at runtime are always a fatal error;
in particular, this adds a check in btree_iter_down() - if we don't find
a key while walking down the btree that's indicative of a topology error
and should be flagged as such, not a null ptr deref.
Some checks in btree_update_interior.c remaining BUG_ONS(), because we
already checked the node for topology errors when starting the update,
and the assertions indicate that we _just_ corrupted the btree node -
i.e. the problem can't be that existing on disk corruption, they
indicate an actual algorithmic bug.
In the future, we'll be annotating the fsck errors list with which
recovery pass corrects them; the open coded "run explicit recovery pass
or fatal error" in bch2_btree_node_check_topology() will in the future
be done for every fsck_err() call.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_update_interior.h')
-rw-r--r-- | fs/bcachefs/btree_update_interior.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_update_interior.h b/fs/bcachefs/btree_update_interior.h index f651dd48aaa0..7ac3e17b84fd 100644 --- a/fs/bcachefs/btree_update_interior.h +++ b/fs/bcachefs/btree_update_interior.h @@ -10,6 +10,8 @@ #define BTREE_UPDATE_JOURNAL_RES (BTREE_UPDATE_NODES_MAX * (BKEY_BTREE_PTR_U64s_MAX + 1)) +int bch2_btree_node_check_topology(struct btree_trans *, struct btree *); + /* * Tracks an in progress split/rewrite of a btree node and the update to the * parent node: |