diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-28 16:21:26 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-04-02 16:02:56 -0400 |
commit | 9fc8394b784abd79f9011d2f24b26f973f111965 (patch) | |
tree | bb50742831e17d43a89260895d9e49fe879f1c34 | |
parent | f62f16c9be960e274b4ebc965f7e2d00f9d6aea2 (diff) |
bcachefs: Work around a journal self-deadlock
bch2_journal_space_available -> bch2_journal_halt() self deadlocks on
journal lock; work around this by dropping/retaking journal lock before
we call bch2_fatal_error().
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/journal_reclaim.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c index 6f1bad522949..a9f7d5a7feb2 100644 --- a/fs/bcachefs/journal_reclaim.c +++ b/fs/bcachefs/journal_reclaim.c @@ -216,7 +216,14 @@ void bch2_journal_space_available(struct journal *j) bch_err(c, "journal stuck\n%s", buf.buf); printbuf_exit(&buf); + /* + * Hack: bch2_fatal_error() calls bch2_journal_halt() which + * takes journal lock: + */ + spin_unlock(&j->lock); bch2_fatal_error(c); + spin_lock(&j->lock); + ret = JOURNAL_ERR_journal_stuck; } else if (!j->space[journal_space_discarded].next_entry) ret = JOURNAL_ERR_journal_full; |