summaryrefslogtreecommitdiff
path: root/fs/bcachefs/recovery.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-03-28 18:29:23 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-05-30 18:17:17 -0400
commitc1d33a25dca5e75ac63534e381b1b4804af389ce (patch)
tree39a1a99e3e4478dd5ca2d76b0400b83484721914 /fs/bcachefs/recovery.c
parent2c67922ede2a7fd51bf7700dec1c95279d184fd7 (diff)
bcachefs: Fix for freespace version upgrade path
It's currently possible to end up in a half-upgraded state where we haven't set the superblock to the new version, but we have run the freespace initialization path. Previously, this meant when running fsck on such a filesystem we wouldn't check the freespace btrees - which is a problem, if they have been initialized and there's something fsck needs to check and fix. Fix this by making bch2_check_alloc_info() check if freespace has been initialized on each device, not by making it run conditionally on the superblock version. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/recovery.c')
-rw-r--r--fs/bcachefs/recovery.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 66492dde7930..68612d52aa83 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -1174,8 +1174,7 @@ use_clean:
bch_verbose(c, "done checking allocations");
}
- if (c->opts.fsck &&
- c->sb.version >= bcachefs_metadata_version_freespace) {
+ if (c->opts.fsck) {
bch_info(c, "checking need_discard and freespace btrees");
err = "error checking need_discard and freespace btrees";
ret = bch2_check_alloc_info(c, true);