diff options
author | Brian Foster <bfoster@redhat.com> | 2023-04-19 18:47:03 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:10:00 +0300 |
commit | 02d51bb9a7315eb569a160363058ca2cd140faa1 (patch) | |
tree | 2352da4077c23a297e02d02a61efdc0a5c85d4df /fs/bcachefs/super.c | |
parent | 251babb55d53d79bba9568d6516fd11128c34606 (diff) | |
download | linux-02d51bb9a7315eb569a160363058ca2cd140faa1.tar.xz |
bcachefs: remove bucket_gens btree keys on device removal
If a device has keys in the bucket_gens btree associated with its
buckets and is removed from a bcachefs volume, fsck will complain
about the presence of keys associated with an invalid device index.
A repair removes the associated keys and restores correctness.
Update bch2_dev_remove_alloc() to remove device related keys at
device removal time to avoid the problem.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r-- | fs/bcachefs/super.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 265ffa9bfd4c..af6cc73d9356 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -1431,6 +1431,8 @@ static int bch2_dev_remove_alloc(struct bch_fs *c, struct bch_dev *ca) bch2_btree_delete_range(c, BTREE_ID_backpointers, start, end, BTREE_TRIGGER_NORUN, NULL) ?: bch2_btree_delete_range(c, BTREE_ID_alloc, start, end, + BTREE_TRIGGER_NORUN, NULL) ?: + bch2_btree_delete_range(c, BTREE_ID_bucket_gens, start, end, BTREE_TRIGGER_NORUN, NULL); if (ret) bch_err(c, "error removing dev alloc info: %s", bch2_err_str(ret)); |