From: Kent Overstreet Date: Mon, 16 Nov 2020 23:21:55 +0000 (-0500) Subject: bcachefs: Dump journal state when the journal deadlocks X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e8bd002b23813f162d83a5c5c3b28832ba88f78e;p=linux.git bcachefs: Dump journal state when the journal deadlocks Currently tracking down one of these bugs. Signed-off-by: Kent Overstreet Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c index e7b60876d09af..32555ccffc0e9 100644 --- a/fs/bcachefs/journal.c +++ b/fs/bcachefs/journal.c @@ -414,8 +414,17 @@ unlock: goto retry; if (ret == -ENOSPC) { - WARN_ONCE(!can_discard && (flags & JOURNAL_RES_GET_RESERVED), - "JOURNAL_RES_GET_RESERVED set but journal full"); + if (WARN_ONCE(!can_discard && (flags & JOURNAL_RES_GET_RESERVED), + "JOURNAL_RES_GET_RESERVED set but journal full")) { + char *buf; + + buf = kmalloc(4096, GFP_NOFS); + if (buf) { + bch2_journal_debug_to_text(&_PBUF(buf, 4096), j); + pr_err("\n%s", buf); + kfree(buf); + } + } /* * Journal is full - can't rely on reclaim from work item due to