diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-28 23:21:26 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:28 +0300 |
commit | 7fda0f08fa86731f057367ca36054d29d0c0344c (patch) | |
tree | 0e1b15e31292deffc4f9af8b59c6637441221546 /fs/bcachefs/journal_reclaim.c | |
parent | 30690c441a6b481aadb0284d1b9bf487f8d28bfc (diff) | |
download | linux-7fda0f08fa86731f057367ca36054d29d0c0344c.tar.xz |
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>
Diffstat (limited to 'fs/bcachefs/journal_reclaim.c')
-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 56b0c018ac26..b30730ce58c5 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 = cur_entry_journal_stuck; } else if (!j->space[journal_space_discarded].next_entry) ret = cur_entry_journal_full; |