bcachefs: Fix lost wakeup on journal shutdown
[linux-2.6-microblaze.git] / fs / bcachefs / journal.c
index f314b2e..9c9a25d 100644 (file)
@@ -511,18 +511,18 @@ retry:
        if (journal_res_get_fast(j, res, flags))
                return 0;
 
+       if (bch2_journal_error(j))
+               return -BCH_ERR_erofs_journal_err;
+
+       if (j->blocked)
+               return -BCH_ERR_journal_res_get_blocked;
+
        if ((flags & BCH_WATERMARK_MASK) < j->watermark) {
                ret = JOURNAL_ERR_journal_full;
                can_discard = j->can_discard;
                goto out;
        }
 
-       if (j->blocked)
-               return -BCH_ERR_journal_res_get_blocked;
-
-       if (bch2_journal_error(j))
-               return -BCH_ERR_erofs_journal_err;
-
        if (nr_unwritten_journal_entries(j) == ARRAY_SIZE(j->buf) && !journal_entry_is_open(j)) {
                ret = JOURNAL_ERR_max_in_flight;
                goto out;