diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-06-08 22:50:30 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2021-06-08 22:50:30 -0400 |
commit | e3a7cee5034f0f218f593a0a970e8ccd8bf99565 (patch) | |
tree | c5c9b4d57f74d19594a082f0085206e2118bed46 /fs/bcachefs/buckets.c | |
parent | 86ab56339cbcbf9941fc2aef6838600a7c1ab2d4 (diff) |
bcachefs: Don't mark superblocks past end of usable spacebcachefs-v5.11
bcachefs-tools recently started putting a backup superblock at the end
of the device. This causes a problem if the bucket size doesn't divide
the device size - but we can fix it by just skipping marking that part.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/buckets.c')
-rw-r--r-- | fs/bcachefs/buckets.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index 2b5e1d5c6a29..76d15a5dc62f 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -631,6 +631,12 @@ void bch2_mark_metadata_bucket(struct bch_fs *c, struct bch_dev *ca, BUG_ON(type != BCH_DATA_sb && type != BCH_DATA_journal); + /* + * Backup superblock might be past the end of our normal usable space: + */ + if (b >= ca->mi.nbuckets) + return; + preempt_disable(); if (likely(c)) { @@ -2084,6 +2090,12 @@ static int __bch2_trans_mark_metadata_bucket(struct btree_trans *trans, }; int ret = 0; + /* + * Backup superblock might be past the end of our normal usable space: + */ + if (b >= ca->mi.nbuckets) + return 0; + a = bch2_trans_start_alloc_update(trans, &iter, &ptr, &u); if (IS_ERR(a)) return PTR_ERR(a); |