]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Fix an assertion
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 25 Jan 2021 19:04:31 +0000 (14:04 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:52 +0000 (17:08 -0400)
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>
fs/bcachefs/alloc_background.c

index 206134fec32099d9e27593374e4a0e0f22502ae5..68fa6caf022dd38e88dfdd460563ecd7b29fd290 100644 (file)
@@ -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;