bcachefs: fix a faulty assertion
authorKent Overstreet <kent.overstreet@gmail.com>
Fri, 8 Mar 2019 04:14:35 +0000 (23:14 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:17 +0000 (17:08 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal.c

index 0aae8fd74c8a5215a0e81ecfe9af27795818dbe6..64f9c5740ec8e0eddb3ea16ec7f979477ba343f2 100644 (file)
@@ -248,13 +248,13 @@ static int journal_entry_open(struct journal *j)
        do {
                old.v = new.v = v;
 
-               EBUG_ON(journal_state_count(new, new.idx));
-
                if (old.cur_entry_offset == JOURNAL_ENTRY_ERROR_VAL)
                        return -EROFS;
 
                /* Handle any already added entries */
                new.cur_entry_offset = le32_to_cpu(buf->data->u64s);
+
+               EBUG_ON(journal_state_count(new, new.idx));
                journal_state_inc(&new);
        } while ((v = atomic64_cmpxchg(&j->reservations.counter,
                                       old.v, new.v)) != old.v);