]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Work around a journal self-deadlock
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 28 Mar 2022 20:21:26 +0000 (16:21 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:28 +0000 (17:09 -0400)
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>
fs/bcachefs/journal_reclaim.c

index 56b0c018ac2630f3571921aa50b2da73786eed9d..b30730ce58c530dead4446d23e73446630000145 100644 (file)
@@ -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;