summaryrefslogtreecommitdiff
path: root/fs/bcachefs/migrate.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-07-10 20:44:42 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:08 +0300
commit9f1833cadda7bb40a77dc9fd1b85798e20d92195 (patch)
tree52cecab2af6a679dfe9b796c0cf6aba2539d9253 /fs/bcachefs/migrate.c
parentf8f86c6aec1ecb21839933ff3615dcd219ef026f (diff)
downloadlinux-9f1833cadda7bb40a77dc9fd1b85798e20d92195.tar.xz
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.c2
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;