From 4529ae09cea2c040180e991ea648588220611497 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Mon, 25 Jan 2021 14:04:31 -0500 Subject: [PATCH] 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 Signed-off-by: Kent Overstreet --- fs/bcachefs/alloc_background.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c index 206134fec3209..68fa6caf022dd 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; -- 2.30.2