From: Kent Overstreet Date: Mon, 25 Jan 2021 19:04:31 +0000 (-0500) Subject: bcachefs: Fix an assertion X-Git-Tag: v6.7-rc1~201^2~1823 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4529ae09cea2c040180e991ea648588220611497;p=thirdparty%2Fkernel%2Fstable.git 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 --- 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;