summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/alloc_background.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-01-25 14:04:31 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:52 -0400
commit4529ae09cea2c040180e991ea648588220611497 (patch)
tree824d1264987fd08400c8bc242a5c83e928c747f0 /fs/bcachefs/alloc_background.c
parentbfcf840ddf0697f991f2591b56a9f1969accbd23 (diff)
downloadlinux-4529ae09cea2c040180e991ea648588220611497.tar.gz
linux-4529ae09cea2c040180e991ea648588220611497.tar.bz2
linux-4529ae09cea2c040180e991ea648588220611497.zip
bcachefs: Fix an assertion
If we're invalidating a bucket that has cached data in it, data_type won't be 0 - oops. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/alloc_background.c')
-rw-r--r--fs/bcachefs/alloc_background.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 206134fec320..68fa6caf022d 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -887,7 +887,7 @@ static int bch2_invalidate_one_bucket2(struct btree_trans *trans,
g = bucket(ca, b);
m = READ_ONCE(g->mark);
- BUG_ON(m.data_type || m.dirty_sectors);
+ BUG_ON(m.dirty_sectors);
bch2_mark_alloc_bucket(c, ca, b, true, gc_pos_alloc(c, NULL), 0);
@@ -903,6 +903,7 @@ static int bch2_invalidate_one_bucket2(struct btree_trans *trans,
*/
if (!m.cached_sectors &&
!bucket_needs_journal_commit(m, c->journal.last_seq_ondisk)) {
+ BUG_ON(m.data_type);
bucket_cmpxchg(g, m, m.gen++);
percpu_up_read(&c->mark_lock);
goto out;