diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-07-10 13:44:42 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:08 -0400 |
commit | 9f1833cadda7bb40a77dc9fd1b85798e20d92195 (patch) | |
tree | 52cecab2af6a679dfe9b796c0cf6aba2539d9253 /fs/bcachefs/migrate.c | |
parent | f8f86c6aec1ecb21839933ff3615dcd219ef026f (diff) | |
download | linux-stable-9f1833cadda7bb40a77dc9fd1b85798e20d92195.tar.gz linux-stable-9f1833cadda7bb40a77dc9fd1b85798e20d92195.tar.bz2 linux-stable-9f1833cadda7bb40a77dc9fd1b85798e20d92195.zip |
bcachefs: Update btree ptrs after every write
This closes a significant hole (and last known hole) in our ability to
verify metadata. Previously, since btree nodes are log structured, we
couldn't detect lost btree writes that weren't the first write to a
given node. Additionally, this seems to have lead to some significant
metadata corruption on multi device filesystems with metadata
replication: since a write may have made it to one device and not
another, if we read that btree node back from the replica that did have
that write and started appending after that point, the other replica
would have a gap in the bset entries and reading from that replica
wouldn't find the rest of the bsets.
But, since updates to interior btree nodes are now journalled, we can
close this hole by updating pointers to btree nodes after every write
with the currently written number of sectors, without negatively
affecting performance. This means we will always detect lost or corrupt
metadata - it also means that our btree is now a curious hybrid of COW
and non COW btrees, with all the benefits of both (excluding
complexity).
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/migrate.c')
-rw-r--r-- | fs/bcachefs/migrate.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/migrate.c b/fs/bcachefs/migrate.c index aacd6385db1f..1f65eca48c6e 100644 --- a/fs/bcachefs/migrate.c +++ b/fs/bcachefs/migrate.c @@ -139,7 +139,7 @@ retry: break; } - ret = bch2_btree_node_update_key(&trans, iter, b, k.k); + ret = bch2_btree_node_update_key(&trans, iter, b, k.k, false); if (ret == -EINTR) { b = bch2_btree_iter_peek_node(iter); ret = 0; |