Commit 2e92d26b authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Fix lost wakeup on journal shutdown

We need to check for journal shutdown first in __journal_res_get() -
after the journal is shutdown, j->watermark won't be changing anymore.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent c502b5b8
...@@ -511,18 +511,18 @@ static int __journal_res_get(struct journal *j, struct journal_res *res, ...@@ -511,18 +511,18 @@ static int __journal_res_get(struct journal *j, struct journal_res *res,
if (journal_res_get_fast(j, res, flags)) if (journal_res_get_fast(j, res, flags))
return 0; 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) { if ((flags & BCH_WATERMARK_MASK) < j->watermark) {
ret = JOURNAL_ERR_journal_full; ret = JOURNAL_ERR_journal_full;
can_discard = j->can_discard; can_discard = j->can_discard;
goto out; 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)) { if (nr_unwritten_journal_entries(j) == ARRAY_SIZE(j->buf) && !journal_entry_is_open(j)) {
ret = JOURNAL_ERR_max_in_flight; ret = JOURNAL_ERR_max_in_flight;
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment