From e8bd002b23813f162d83a5c5c3b28832ba88f78e Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Mon, 16 Nov 2020 18:21:55 -0500 Subject: [PATCH] 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 --- fs/bcachefs/journal.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c index e7b60876d09a..32555ccffc0e 100644 --- a/fs/bcachefs/journal.c +++ b/fs/bcachefs/journal.c @@ -414,8 +414,17 @@ static int __journal_res_get(struct journal *j, struct journal_res *res, 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