bcachefs: Fix assert for online fsck
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 16 Dec 2024 21:41:25 +0000 (16:41 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 10 Jan 2025 04:38:41 +0000 (23:38 -0500)
We can't check if we're racing with fsck ending until mark_lock is held.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/disk_accounting.h

index fc1b673689c80e1f89f54bc61366f2834b65ae9b..5360cbb3ec298f9333090f67c9d8103b3ecabb57 100644 (file)
@@ -138,7 +138,8 @@ static inline int bch2_accounting_mem_mod_locked(struct btree_trans *trans,
        bpos_to_disk_accounting_pos(&acc_k, a.k->p);
        bool gc = mode == BCH_ACCOUNTING_gc;
 
-       EBUG_ON(gc && !acc->gc_running);
+       if (gc && !acc->gc_running)
+               return 0;
 
        if (!bch2_accounting_is_mem(acc_k))
                return 0;